From 20169abc828f97ae9616c46c5a48ba31954c0f94 Mon Sep 17 00:00:00 2001 From: Price Hiller Date: Thu, 17 Mar 2022 15:34:22 -0500 Subject: [PATCH] feat(profile): git aliases --- .profile | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/.profile b/.profile index 43042a12..c197aead 100644 --- a/.profile +++ b/.profile @@ -96,10 +96,19 @@ if which git >/dev/null 2>&1; then alias gr="git remote" alias gl="git log" alias gw="git worktree" + alias gwa="git worktree add" + alias gwr="git worktree remove" alias git-remote="git config --get remote.origin.url" - alias gfo="git fetch origin 'refs/heads/*:refs/heads/*'" + alias gbc="git config remote.origin.fetch '+refs/heads/*:refs/remotes/origin/*'" fi +gbf() { + local remote + local default_branch + remote="${1:=origin}" + default_branch="$(git remote show "${remote}" | awk '/HEAD branch/ {print $NF}')" + git fetch "${remote}" "${default_branch}":"${default_branch}" +} ## Mac Specific Aliases ## if [[ "${OSTYPE}" = "darwin"* ]]; then alias c="pbcopy"