From 779b9b5a6f208fe930bf830675cd584a932f64f1 Mon Sep 17 00:00:00 2001 From: binaryDiv Date: Wed, 4 May 2022 11:04:55 +0200 Subject: [PATCH] gitconfig: Change "fetch-pr" alias to "checkout-pr" --- .gitconfig.inc/common.gitconfig | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) 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"