Skip to content

Commit 356a72a

Browse files
TrottMylesBorins
authored andcommitted
doc: explain what to do if git push is rejected
In COLLABORATOR_GUIDE.md, explain what to do if `git push upstream master` is rejected. PR-URL: #14848 Fixes: #12628 Reviewed-By: James M Snell <[email protected]> Reviewed-By: Yuta Hiroto <[email protected]> Reviewed-By: Michaël Zasso <[email protected]>
1 parent e263c02 commit 356a72a

File tree

1 file changed

+27
-0
lines changed

1 file changed

+27
-0
lines changed

COLLABORATOR_GUIDE.md

+27
Original file line numberDiff line numberDiff line change
@@ -512,6 +512,33 @@ your pull request shows the purple merged status then you should still
512512
add the "Landed in <commit hash>..<commit hash>" comment if you added
513513
multiple commits.
514514

515+
### Troubleshooting
516+
517+
Sometimes, when running `git push upstream master`, you may get an error message
518+
like this:
519+
520+
```console
521+
To https://github.com/nodejs/node
522+
! [rejected] master -> master (fetch first)
523+
error: failed to push some refs to 'https://github.com/nodejs/node'
524+
hint: Updates were rejected because the remote contains work that you do
525+
hint: not have locally. This is usually caused by another repository pushing
526+
hint: to the same ref. You may want to first integrate the remote changes
527+
hint: (e.g., 'git pull ...') before pushing again.
528+
hint: See the 'Note about fast-forwards' in 'git push --help' for details.
529+
```
530+
531+
That means a commit has landed since your last rebase against `upstream/master`.
532+
To fix this, fetch, rebase, run the tests again (to make sure no interactions
533+
between your changes and the new changes cause any problems), and push again:
534+
535+
```sh
536+
git fetch upstream
537+
git rebase upstream/master
538+
make -j4 test
539+
git push upstream master
540+
```
541+
515542
### I Just Made a Mistake
516543

517544
* Ping a CTC member.

0 commit comments

Comments
 (0)