Skip to content

Instantly share code, notes, and snippets.

@hyperair
Last active July 5, 2017 06:49
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 hyperair/e78d325577187db22ac5 to your computer and use it in GitHub Desktop.
Save hyperair/e78d325577187db22ac5 to your computer and use it in GitHub Desktop.
Setup pull request fetching for github repo
#!/bin/sh
git remote -v | grep fetch | \
grep -e git@github.com -e git://github -e github: -e gh: | \
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"'/pr/*'
git config --add "remote.$remote.fetch" \
'+refs/pull/*/merge:refs/remotes/'"$remote"'/prm/'*
fi
done
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment