Merging a Pull Request in Visual Studio

November 21, 2014, (updated on January 12, 2015), Software Development

Recently I tried to merge a Pull Request from CodePlex directly in Visual Studio. However, if the Pull Request comes from a forked repository, there is no way around using the command line tools to pull the remote branch into a local branch. It is actually very simple; just perform the following steps.

Pull the changes

Note: If the Pull Request’s branch is in the same repository, you can simply press on New Branch… in Visual Studio and select the appropriate branch in the drop down list. In this case you don’t need to do the next three steps.

  1. In the Team Explorer‘s Branches view, select Actions / Open Command Prompt: This action opens a command prompt whose current directory is set to the root of your local Git repository.


  2. In the command prompt, create a new local temporary branch and switch to it.

    git checkout -b TemporaryBranch
  3. Next, pull the remote branch from the fork into the temporary branch. The first parameter of the pull command is the remote repository URL, the second parameter is the name of the remote branch to pull into your temporary branch.

    git pull master

Test the changes

After the previous steps, you should automatically see the new, unpublished branch “TemporaryBranch” in Visual Studio:


Now test the application with the changes from the Pull Request…

Push the changes

When everything is fine, you can merge the branch back into the “master” branch:

  1. Right-click the “TemporaryBranch” branch and select Merge…


  2. Select the “TemporaryBranch” branch on the left and the “master” branch on the right.


  3. After pressing the “Merge” button, the changes are merged into the “master” branch and Visual Studio switches back to the “master” branch. Check if the merge worked without issues (e.g. compile and run unit tests).

  4. Press the “Sync” button to push the “Unsynced Commits” back to the main repository server.


  5. Now you can delete the “TemporaryBranch” branch directly in Visual Studio:


Note: Of course, this also works if you want to merge a Pull Request into a branch different then the “master” branch…

Do you have some suggestions about how to improve this workflow?

Tags: , , , , , ,

Leave a Reply

Your email address will not be published. Required fields are marked *

To create code blocks or other preformatted text, indent by four spaces:

    This will be displayed in a monospaced font. The first four 
    spaces will be stripped off, but all other whitespace
    will be preserved.
    Markdown is turned off in code blocks:
     [This is not a link](

To create not a block, but an inline code span, use backticks:

Here is some inline `code`.

For more help see

This site uses Akismet to reduce spam. Learn how your comment data is processed.