Git: How to finish a PR for someone who is away on vacation

In this video, I demonstrate the following procedure using a colleague’s PR as an example.

How to get a copy of someone else’s pull request from Rolfe Dlugy-Hegwer on Vimeo.

Suppose you work with someone who is away for the Thanksgiving or Christmas holidays. What if you need to make changes to their pull request and get them merged before they return?


You and your colleague both have forks of the same upstream repo.

You have already cloned your fork of the repo to your local machine and set up the upstream remote.


Change to your repo directory. For example, enter:

$ cd openshift-docs

Add a remote that points to your colleague’s fork of the repo, as shown in the video. You go to GitHub, find your colleague’s PR, go to their fork, copy the URL of their fork, and paste it into the following command. Also name the remote you’re creating. This name can be an arbitrary string, but I recommend using the person’s first name.

$ git remote add <remote-name> <url-of-their-fork>

For example, enter:

$ git remote add roberto

Create a working branch:

$ git status
$ git checkout -b <working-branch-name>

For example, enter:

$ git status
$ git checkout -b  xyz-456

On GitHub, return to the PR, copy the name of the other user’s working branch, and paste it into the following command:

$ git pull <remote-name> <remote-branch>

For example, enter:

$ git pull roberto abc-123

Git displays a commit message, usually in vi, that says something about the merge you just performed. In vi, you can save this commit message by pressing the Esc, :, w, and q keys.

In your local working branch, open one of the files you know your colleague changed in their PR. If you’ve done everything correctly, you should be able to see changes from their PR in your local working branch.

Make your changes to the content.

When you’re ready, push the changes by entering:

$ git push origin HEAD

Create a pull request for your working branch on GitHub by visiting the remote URL shown in the command output from the previous command. Right-click the URL and select open. For example:

remote: Create a pull request for 'xyz-456' on GitHub by visiting:

Additional resources

Leave a Comment

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s