From 58d303799508555bccf01c4c691bec52e355e6ad Mon Sep 17 00:00:00 2001 From: Jeremy Kaplan Date: Fri, 7 Aug 2020 23:57:51 -0700 Subject: [PATCH] git: Move fb alias to full command --- bin/git-fetch-branch | 26 ++++++++++++++++++++++++++ git/config | 2 +- 2 files changed, 27 insertions(+), 1 deletion(-) create mode 100755 bin/git-fetch-branch diff --git a/bin/git-fetch-branch b/bin/git-fetch-branch new file mode 100755 index 0000000..668c298 --- /dev/null +++ b/bin/git-fetch-branch @@ -0,0 +1,26 @@ +#!/usr/bin/env bash + +export USAGE=' +or: +' + +# This is the recommended pattern from `man git-sh-setup`. +# +# shellcheck disable=SC1090 +. "$(git --exec-path)/git-sh-setup" + +set -euo pipefail + +case "$#" in + 1) + remote='origin' + branch="$1" + ;; + 2) + remote="$1" + branch="$2" + ;; + *) usage ;; +esac + +exec git fetch "${remote}" "${branch}" diff --git a/git/config b/git/config index 8675016..d2219a6 100644 --- a/git/config +++ b/git/config @@ -33,7 +33,7 @@ dc = diff --cached d = diff dn = diff --name-only --relative dw = diff --word-diff -fb = "!fb() { git fetch \"$1\" \"$2\":\"$2\"; }; fb" +fb = fetch-branch f = fetch fp = fetch --prune fixup = commit --amend --no-edit