Skip to content

Instantly share code, notes, and snippets.

@revans
Last active December 26, 2015 03:39
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 revans/7086989 to your computer and use it in GitHub Desktop.
Save revans/7086989 to your computer and use it in GitHub Desktop.
Git Extension for easily pulling down specific Pull Requests from github or setting your local repository to access all Pull Requests
#!/bin/bash
set -e
arg=$1
function specific_pull_request() {
echo "Fetching Pull Request '${arg}' from Github..."
git fetch origin pull/$arg/head:pr-$arg
}
function generic_pull_request() {
echo "Setting up your local Git repo to be able to pull all Pull Requests from Github."
git config --add remote.origin.fetch '+refs/pull/*/head:refs/remotes/origin/pr/*'
}
case $arg in
''|*[!0-9]*) generic_pull_request ;;
*) specific_pull_request ;;
esac
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment