Skip to content

Merging a PR contribution

Seth Ladd edited this page Aug 10, 2015 · 5 revisions

This document explains how to cleanly land a pull request (PR) from a contributor. Assumes the PR exists against the dart-lang/sdk repo and that the PR has received an LGTM.

Setup global aliases

Add these to the [alias] section of your Git global config.

[alias]
  pl = log --pretty=format:'%h %s' --graph
  pr = "!f() { git fetch origin refs/pull/$1/head:pr/$1; } ; f"

Cleanly merging in pull requests

  1. Set up the pr alias from above
  2. Start on the master branch. Make sure you've updated to latest.
  3. git checkout master
  4. git pull origin master
  5. Let’s say we’re dealing with Pull Request #42
  6. Run git pr 42
    • You’ll notice a new branch created pr/42
  7. Checkout pr/42
    • git checkout p/42
  8. Rebase pr/42 on top of master. This makes sure the history is replayed on latest.
    • git rebase origin/master
  9. Now checkout master and rebase to pr/42
    • git checkout master
    • git rebase pr/42
    • This updates your local master branch to be the same as pr/42
  10. Push to origin.
    • git push
Clone this wiki locally