Skip to content

Instantly share code, notes, and snippets.

@searls
Created March 4, 2019 18:06
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save searls/93b646aed109a081e93c6f7757e552c4 to your computer and use it in GitHub Desktop.
Save searls/93b646aed109a081e93c6f7757e552c4 to your computer and use it in GitHub Desktop.

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

Open the PR

  1. Start the branch with git checkout -b blah-blah
  2. commit stuff
  3. git push
  4. 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

Updating master

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"

  1. git checkout blah-blah (my feature branch)
  2. git fetch origin to get the latest and greatest
  3. git rebase origin/master to replay whatever's happened on master to blah-blah so that my new commits are sitting neatly on top and can neatly merge
  4. Pray that no merge conflicts occur during that rebase, but if they do, resolve them in a text editor, git add the affected files, and git rebase --continue until it exits successfully
  5. 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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment