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.
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
Most helpful comment
I'd just do: