Forked from piscisaureus
Locate the section for your vsts remote in the .git/config
file. It looks like this:
[remote "origin"]
fetch = +refs/heads/*:refs/remotes/origin/*
url = ssh://[email protected]:22/DefaultCollection/Project-Name/_git/Repo-Name
Now add the line fetch = +refs/pull/*/merge:refs/remotes/origin/pull/*
to this section. Obviously, change the url to match your project's URL. It ends up looking like this:
[remote "origin"]
fetch = +refs/heads/*:refs/remotes/origin/*
url = ssh://[email protected]:22/DefaultCollection/Project-Name/_git/Repo-Name
fetch = +refs/pull/*/merge:refs/remotes/origin/pull/*
Now fetch all the pull requests:
$ git fetch origin
From ssh://[email protected]:22/DefaultCollection/Project-Name/_git/Repo-Name
* [new ref] refs/pull/1000/merge -> origin/pull/1000
* [new ref] refs/pull/1002/merge -> origin/pull/1002
* [new ref] refs/pull/1004/merge -> origin/pull/1004
* [new ref] refs/pull/1009/merge -> origin/pull/1009
...
To check out a particular pull request:
$ git checkout pull/1009
Branch pull/1009 set up to track remote branch pull/1009 from origin.
Switched to a new branch 'pull/1009'