Forked from piscisaureus
To identify one particular pull request, find the pull request number on the Azure DevOps site:
Then fetch and checkout the pull request in a local branch named pull/137
git fetch origin pull/137/merge:pull/137
git checkout pull/137
Now add the line fetch = +refs/pull/*/merge:refs/remotes/origin/pull/*
to your local .git/config
file. It looks like this:
git config --add remote.origin.fetch "+refs/pull/*/merge:refs/remotes/origin/pull/*"
Your local .git/config
file looks now like this:
[remote "origin"]
url = ssh://[email protected]:22/DefaultCollection/Project-Name/_git/Repo-Name
fetch = +refs/pull/*/merge:refs/remotes/origin/pull/*
fetch = +refs/heads/*:refs/remotes/origin/*
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/137/merge -> origin/pull/137
to checkout a pull request into a local branch named pull/137
use:
$ git checkout pull/137
Branch pull/137 set up to track remote branch pull/137 from origin.
Switched to a new branch 'pull/137'
git config --global --add remote.origin.fetch "+refs/pull/*/head:refs/remotes/origin/pr/*"
- See the discussion at https://gist.github.com/piscisaureus/3342247 for more insights
Exactly what I needed thank you!