diff --git a/.gitconfig.inc/common.gitconfig b/.gitconfig.inc/common.gitconfig index 6e9249d..24c733e 100644 --- a/.gitconfig.inc/common.gitconfig +++ b/.gitconfig.inc/common.gitconfig @@ -62,5 +62,5 @@ # Submodule helpers sm-update = submodule update --init --recursive --remote --merge - # Fetch a branch from a pull request (supported by GitHub) - fetch-pr = "!f() { [ $# -eq 2 ] || { echo 'Usage: git fetch-pr PULL_REQUEST_ID BRANCH_NAME'; exit 1; }; git fetch origin pull/$1/head:$2; }; f" + # Checkout a branch from a pull request (supported by GitHub) + checkout-pr = "!f() { [ $# -ge 1 ] || { echo 'Usage: git fetch-pr PULL_REQUEST_ID [BRANCH_NAME]'; exit 1; }; BRANCH=${2-pull-request-$1}; git fetch origin pull/$1/head:$BRANCH && git switch $BRANCH; }; f"