1
0
mirror of https://github.com/frebib/dotfiles.git synced 2024-06-14 12:57:23 +00:00

aliases: git: gfrb/gfrbi defaults to defbranch

Much like how `git pull` will default to the remote tracking branch if
called with no arguments, gfrb and gfrbi will fetch and rebase from the
"default" branch according to git defbranch.

Signed-off-by: Joe Groocock <me@frebib.net>
This commit is contained in:
Joe Groocock 2022-10-30 13:43:18 +00:00
parent a7af23bfbb
commit 73131b086f
Signed by: frebib
GPG Key ID: E0B16BEACFBB6A86

View File

@ -138,9 +138,9 @@ alias grba="grb --abort"
alias grbc="grb --continue"
alias grbsk="grb --skip"
alias grbsh="grb --show-current"
alias grbom="git rebase \"origin/\$(git defbranch)\""
gfrb() { remote="${1%/*}"; git fetch "$remote" && git rebase "$@"; }
gfrbi() { remote="${1%/*}"; git fetch "$remote" && git rebase -i "$@"; }
alias grbom="git rebase \"origin/\$(git defbranch origin)\""
gfrb() { ref="${1:-origin/$(git defbranch origin)}"; remote="${ref%%/*}"; git fetch "$remote" && git rebase "$ref" "${@:2}"; }
gfrbi() { ref="${1:-origin/$(git defbranch origin)}"; remote="${ref%%/*}"; git fetch "$remote" && git rebase -i "$ref" "${@:2}"; }
alias gam="git am"
alias gama="git am --abort"