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"