1
0
mirror of https://git.decapod.one/brethil/dotfiles synced 2024-11-22 03:21:30 +01:00

Add four new git function with the help of fzf

This commit is contained in:
karajan1001 2022-08-18 20:56:34 +08:00
parent dea326e488
commit b2df319e18

View File

@ -74,3 +74,43 @@ compdef "__git_completion_wrapper __git_branch_names" git-diff-branch
function git-show-changes(){ function git-show-changes(){
git log --reverse HEAD^.. 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
}