Suppose someone (not me) submitted a Pull Request on GitHub.

Locally, I would like to run that work. Hence, I need to have the code locally. Following this documentation, I can achieve that in the terminal with:

$ git fetch origin pull/ID/head:BRANCH_NAME

ID is the PR #number on GitHUb. And BRANCH_NAME is the branch associated to the PR.

I tried doing the same via Magit interface but had no success.

I tried pressing f (associated to command Fetch. Then, typing e as elsewhere and typing origin pull/ID/head:BRANCH_NAME or origin/pull/ID/head:BRANCH_NAME. But, it did not work out.

How can I achieve the same via Magit?

1 Answer 1


Execute the instructions below:

1 - execute f

2 - press r as explicit refspec

3 - type origin (since terminal used origin, could be another thing...)

4 - type pull/ID/head:BRANCH_NAME


Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.