Checking Out Visual Studio Online Pull Requests Locally

March 30, 2015

Pull Requests in Visual Studio Online are great way to perform code reviews. But if you like reviewing code in your favorite editor, instead of on the web, they can be frustrating. Fortunately, you can set up git to fetch pull requests from Visual Studio Online.

Visual Studio Online creates branches for pull requests in the refs/pull/* namespace, which is not fetched in a default configuration. To set up your git client to fetch them, simply run:

git config --add remote.origin.fetch +refs/pull//merge:refs/remotes/origin/pr/

Now on your next git fetch, you will download the pull requests, and you can simply check out the one you're interested in:

git checkout pr/20804