Add four new git function with the help of fzf

pull/6/head
karajan1001 2022-08-18 20:56:34 +08:00
parent dea326e488
commit b2df319e18
1 changed files with 40 additions and 0 deletions

View File

@ -74,3 +74,43 @@ compdef "__git_completion_wrapper __git_branch_names" git-diff-branch
function git-show-changes(){
git log --reverse HEAD^..
}
unalias gco
function gco() {
if [[ "$#" -ge 1 ]]; then
g checkout $@
elif [[ "$#" -eq 0 ]]; then
g checkout $(gb | fzf)
fi
}
unalias gcor
function gcor() {
if [[ "$#" -ge 1 ]]; then
g checkout $@
elif [[ "$#" -eq 0 ]]; then
g checkout --track $(gbr | fzf)
fi
}
unalias gbd
function gbd() {
if [[ "$#" -ge 1 ]]; then
g branch -d $@
elif [[ "$#" -eq 0 ]]; then
g branch -d $(gb | fzf -m)
fi
}
unalias gbD
function gbD() {
if [[ "$#" -ge 1 ]]; then
g branch -D $@
elif [[ "$#" -eq 0 ]]; then
g branch -D $(gb | fzf -m)
fi
}