Skip to content

Instantly share code, notes, and snippets.

@jarib
Last active February 23, 2017 05:05
Show Gist options
  • Save jarib/5254998 to your computer and use it in GitHub Desktop.
Save jarib/5254998 to your computer and use it in GitHub Desktop.
# 1. add the contributor as a remote
$ git remote add <contributor-name> <contributor-url>

# 2. create a throw-away branch for the merge in case we mess up
$ git checkout -b test-merge

# 3. fetch the remote and reset to the branch they made the PR from
$ git fetch <contributor-name>
$ git reset --hard <contributor-name>/<pull-request-branch-name>
# 3b. here you can squash with `git rebase -i ...` if necessary

# 4. move the contributor's change to the top of the history
$ git rebase origin/master
$ git log 

# 5. merge back to master - should be a fast-forward
$ git checkout master
$ git merge test-merge
$ git branch -d test-merge
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment