This will get well-actually'd to death, but to keep it simple, here's what I have been doing for the last several years when I have an open PR and master gets ahead of me
- Start the branch with
git checkout -b blah-blah
- commit stuff
- git push
- Rush to the web UI and click "open pull request" after I see the "new branch" detected and mark it as WIP or whatever if it's not ready to merge right away
If master has had commits since I opened my PR, I'll do the following to update the PR without creating commits that are basically "merge master into my PR branch"
git checkout blah-blah
(my feature branch)git fetch origin
to get the latest and greatestgit rebase origin/master
to replay whatever's happened on master toblah-blah
so that my new commits are sitting neatly on top and can neatly merge- Pray that no merge conflicts occur during that rebase, but if they do, resolve them in a text editor,
git add
the affected files, andgit rebase --continue
until it exits successfully git push --force
to override my PR's branch
This way if the build is green, we can be reasonably confident it'll stay green when we click merge.