Node: doc, meta: document what to do if `git push upstream master` is rejected

Created on 24 Apr 2017  路  4Comments  路  Source: nodejs/node

  • Subsystem: doc, meta

Trying to land a big PR after syncing the masters, while other collaborators actively pushed the same time, I've got this:

To https://github.com/nodejs/node
 ! [rejected]              master -> master (fetch first)
error: failed to push some refs to 'https://github.com/nodejs/node'
hint: Updates were rejected because the remote contains work that you do
hint: not have locally. This is usually caused by another repository pushing
hint: to the same ref. You may want to first integrate the remote changes
hint: (e.g., 'git pull ...') before pushing again.
hint: See the 'Note about fast-forwards' in 'git push --help' for details.

Maybe it is worth to be documented in the COLLABORATOR_GUIDE.md#technical-howto what to do in this case.

doc meta

Most helpful comment

I'd just do:

git fetch --all
git rebase
git push

All 4 comments

Briefly, my usual workflow would be:

git checkout -b tmp
git checkout master
git remote update -p
git merge --ff-only upstream/master
git checkout tmp
git rebase master

<after rebase>

git checkout master
git merge --ff-only tmp

Although if I was merging someone else's pr without conflicts, I'd just git am the patch again after rebasing master. Typically much easier.

I'd just do:

git fetch --all
git rebase
git push
Was this page helpful?
0 / 5 - 0 ratings