Last active
March 16, 2017 17:12
-
-
Save jbarnoud/22b41564214b38dbb76997dd210ae482 to your computer and use it in GitHub Desktop.
A bash function that allows you to quickly checkout a branch for a pull request on a repo.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Checkout a branch for a pull request | |
# Inspired from | |
# https://gist.github.com/captainsafia/954351fc7b05bb748b5d2112624f8a2f | |
function gh-pull { | |
if [[ "$#" != 2 ]] | |
then | |
echo "Arguments must be <remote> <PR-ID>." | |
return 1 | |
fi | |
remote=$1 | |
pr_id=$2 | |
git fetch $remote pull/${pr_id}/head:pr-${pr_id} | |
git checkout pr-${pr_id} | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
jon@gerard:~/dev/mdanalysis$ gh-pull upstream 1215 | |
remote: Counting objects: 10, done. | |
remote: Total 10 (delta 8), reused 8 (delta 8), pack-reused 2 | |
Unpacking objects: 100% (10/10), done. | |
From github.com:MDAnalysis/mdanalysis | |
* [new ref] refs/pull/1215/head -> pr-1215 | |
Switched to branch 'pr-1215' |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
More than inspired from captainsafia/gh-pull.fish.