Created
February 12, 2023 13:04
-
-
Save henninghall/7997047851b17063fc510281e6fed269 to your computer and use it in GitHub Desktop.
git command to checkout PR from another fork
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
git config --global alias.pr '!f() { if [ $# -lt 1 ]; then echo "Usage: git pr <id> [<remote>] # assuming <remote>[=origin] is on GitHub"; else git checkout -q "$(git rev-parse --verify HEAD)" && git fetch -fv "${2:-origin}" pull/"$1"/head:pr/"$1" && git checkout pr/"$1"; fi; }; f' | |
# Usage: git pr 123 (where 123 is the number of the pr) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment