Skip to content

Instantly share code, notes, and snippets.

@philpennock
Created April 8, 2015 16:56
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save philpennock/e5b1654a6c4f403cd046 to your computer and use it in GitHub Desktop.
Save philpennock/e5b1654a6c4f403cd046 to your computer and use it in GitHub Desktop.
Bourne-shell snippet for fixing up a git repo cloned from github to add the PR fetch set, for CLI diff of a PR.
origin_url=$(git config --local --get remote.origin.url)
case $origin_url in
github:*|git@github.*|*//github.*)
fetches="$(git config --local --get-all remote.origin.fetch)"
case $fetches in
*origin/pr/*) # no action
;;
*)
git config --local --add remote.origin.fetch '+refs/pull/*/head:refs/remotes/origin/pr/*'
;;
esac
;;
esac
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment