Skip to content

Instantly share code, notes, and snippets.

Last active January 30, 2023 00:56
  • Star 1 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
Star You must be signed in to star a gist
Save bryanbraun/f06a5b91791c4e9c8574 to your computer and use it in GitHub Desktop.
Checkout Github Pull Requests locally without adding remotes
# Edit the .git/config file in your local repo like so:
# cd <path/to/project>
# vim .git/config
# (include the lines below)
[remote "origin"]
url =
fetch = +refs/heads/*:refs/remotes/origin/*
fetch = +refs/pull/*/head:refs/pull/origin/*
# Note: The last line is the new one. The other lines will already be present
# if you have defined a remote repository named "origin".
# Now to checkout a pull request locally (like PR #14), just run:
# git fetch origin
# git checkout -b branch-name refs/pull/origin/14
# For more information, see:
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment