Created
May 21, 2020 01:25
-
-
Save lanefu/46933e635dbafe74372c43b8fce07cf7 to your computer and use it in GitHub Desktop.
Checkout pull request from GitHub repo.
This file contains hidden or 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
#!/bin/bash | |
#ex: /usr/local/bin/checkoutGitHubPR.sh 1234 | |
REMOTE_REPO=origin ## name of your git remote.. typically origin or upstream | |
MERGE_STATE=merge ## set to "merge" to checkout PR merged against repo, or set to "head" to checkout PR unmerged | |
PR=${1} ## github pull request number | |
git fetch -v ${REMOTE_REPO} +refs/pull/${PR}*:refs/remotes/${REMOTE_REPO}/pull/${PR}* | |
git checkout -f ${REMOTE_REPO}/pull/${PR}/${MERGE_STATE} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment