Skip to content

Instantly share code, notes, and snippets.

@chernjie
Created February 9, 2015 09:25
Show Gist options
  • Star 11 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save chernjie/b16fe4dccf3f386d52ff to your computer and use it in GitHub Desktop.
Save chernjie/b16fe4dccf3f386d52ff to your computer and use it in GitHub Desktop.
Fetch Github's Pull Request as a remote branch
#!/usr/bin/env bash
git remote -v | grep fetch | grep github | \
while read remote url _; do
if ! git config --get-all "remote.$remote.fetch" | grep -q refs/pull
then
git config --add "remote.$remote.fetch" \
'+refs/pull/*/head:refs/remotes/'"$remote"'/pull/*'
fi
done
@chernjie
Copy link
Author

chernjie commented Feb 9, 2015

c/o @hyperair

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment