diff --git a/fish.configlink/functions/aliases.fish b/fish.configlink/functions/aliases.fish index 81c07e0..793a668 100644 --- a/fish.configlink/functions/aliases.fish +++ b/fish.configlink/functions/aliases.fish @@ -30,9 +30,9 @@ function aliases --description 'All aliases' abbr -a gco 'git checkout' abbr -a gcom 'git checkout master' abbr -a gcob 'git checkout -b' - abbr -a gcof 'git-checkout-fuzzy' abbr -a gb 'git branch' - abbr -a gbd 'git-delete-fuzzy' + abbr -a gbd 'git branch -d' + abbr -a gbD 'git branch -D' abbr -a gr 'git reset' abbr -a grh 'git reset --hard' abbr -a gm 'git merge' diff --git a/fish.configlink/functions/gittools.fish b/fish.configlink/functions/gittools.fish index 552075f..a3355ae 100644 --- a/fish.configlink/functions/gittools.fish +++ b/fish.configlink/functions/gittools.fish @@ -14,11 +14,43 @@ function gittools end function git-merge-fuzzy - git merge (git-fuzzy-branch "merge from...") + set branch (git-fuzzy-branch "merge from...") + and git merge end function git-delete-fuzzy - git branch -d (git-fuzzy-branch "delete branch...") + set branch (git-fuzzy-branch "delete branch...") + and git branch -d + end + + function git-force-delete-fuzzy + set branch (git-fuzzy-branch "force delete branch...") + and git branch -D + end + + function git + if contains f $argv + switch $argv[1] + case "checkout" + git-checkout-fuzzy + case "merge" + git-merge-fuzzy + case "branch" + if test "$argv[2]" = "-d" + git-delete-fuzzy + else if test "$argv[2]" = "-D" + git-force-delete-fuzzy + else + echo "Not a fuzzy option." + return 1 + end + case "*" + echo "No fuzzy option." + return 1 + end + else + command git $argv + end end end