I'd like to check out a previously created pull request (created via GitHub web interface). I searched and found different places where a refs/pull or refs/pull/pr
But when I add fetch = +refs/pull/*/head:refs/remotes/origin/pr/*
to the git config file and do a git fetch
What I'm doing wrong? Should GitHub create automatically the pull/xyz stuff, or do I have to configure something?
That gist does describe what happend when you do a git fetch:
You have various scripts listed in issues 259 to automate that task.
The git-extras project proposes the command
git-pr
(implemented in PR 262)git-pr
(1) -- Checks out a pull request locallyThis will fetch without you having to name a branch:
How do I get a specific pull request on my machine?
For Bitbucket, you need replace the word
pull
topull-requests
.First, you can confirm the pull request URL style by
git ls-remote origin
command.As you can see, it is
refs/pull-requests/1503/from
instead ofrefs/pull/1503/from
Then you can use the commands of any of the answers.
If you're following the "github fork" workflow, where you create a fork and add the remote upstream repo:
to pull into your current branch your command would look like:
to pull into a new branch the code would look like:
If their commits are on there master branch of their forked repo, then you could just do the following.
If you are using Github.com, go to "Pull requests", click on the relevant pull request, and then click on the "command line instructions" link: