Locate the section for your Bitbucket Server remote in the .git/config
file. It looks like this:
[remote "origin"]
fetch = +refs/heads/*:refs/remotes/origin/*
url = git@<your repo url>
Now add the line fetch = +refs/pull-requests/*/from:refs/remotes/origin/pull-requests/*
to this section. Obviously, change the github url to match your project's URL. It ends up looking like this:
[remote "origin"]
fetch = +refs/heads/*:refs/remotes/origin/*
url = git@<your repo url>
fetch = +refs/pull-requests/*/from:refs/remotes/origin/pull-requests/*
Now fetch all the pull requests:
$ git fetch origin
From <your repo url>
* [new ref] refs/pull-requests/1000/from -> origin/pull-requests/1000
* [new ref] refs/pull-requests/1002/from -> origin/pull-requests/1002
* [new ref] refs/pull-requests/1004/from -> origin/pull-requests/1004
* [new ref] refs/pull-requests/1009/from -> origin/pull-requests/1009
...
To check out a particular pull request:
$ git checkout pull-requests/999
Branch pull-requests/999 set up to track remote branch pull-requests/999/from from origin.
Switched to a new branch 'pull-requests/999'