I\'m aware of How can I check out a GitHub pull request?
While adding fetch = +refs/pull/*/head:refs/remotes/origin/pr/*
to .git/config
does al
You've only fetched branches, not pull requests. Add this to your config:
fetch = +refs/pull/*/head:refs/pulls/origin/pr/*
After that you can checkout a branch that points to a PR remote ref:
git checkout -b "pr-123" pulls/origin/pr/123
Generally, you can check out a ref if you've fetched it from the remote, so look through the git fetch
command output and find the PR's ref name. That's what you should put in the checkout
command. You should see something like:
[new ref] refs/pull/123/head -> refs/pulls/origin/pr/123
Note that you can substitute the pulls
part for any custom prefix. You can now create a branch and point it to pulls/origin/pr/123
, which is equivalent to refs/pulls/origin/pr/123
(see git refspec doc).