Updating a pull request to your repository

When someone submits a pull request to your repository, it is actually possible to update their pull request by pushing commits to their fork.

View Gist

In other words, you can push to a pull request branch, as long as the fork owner has allowed it while creating the pull request.

pr

Suppose you receive a pull request against your repo, yourname/yourrepo.git and you receive a pull request from otheruser’s fork of yourrepo.git.

Start by adding the other user’s repo as a remote.

git remote add otheruser [email protected]:otheruser/yourrepo.git

Fetch the commits from their repo to your local repo.

git fetch otheruser

Now create a local branch from their repository. It’s a good idea to name the branch after their repo name and branch name, as it helps identify the ‘who’ and ‘what’ later. In this example the otheruser simply worked on the master branch.

git checkout -b otheruser-master otheruser/master 

At this point you should make the changes that you want. Once you’re done, you can push to their repo.

git push otheruser HEAD:master

Updated: