mirror of
https://github.com/nmasur/dotfiles
synced 2024-11-09 23:22:57 +00:00
aliases for fuzzy git, replacing normal command
This commit is contained in:
parent
8c4e802f7d
commit
fa1a40112d
@ -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'
|
||||
|
@ -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
|
||||
|
Loading…
Reference in New Issue
Block a user