From 59160eb247ec89ae6c21b36cb557db59cf220b03 Mon Sep 17 00:00:00 2001 From: Noah Masur Date: Thu, 26 Nov 2020 14:28:05 -0500 Subject: [PATCH] fuzzy git reset --- fish.configlink/functions/gittools.fish | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/fish.configlink/functions/gittools.fish b/fish.configlink/functions/gittools.fish index 93d104c..a0540d5 100644 --- a/fish.configlink/functions/gittools.fish +++ b/fish.configlink/functions/gittools.fish @@ -22,8 +22,8 @@ function gittools --height 50% \ --preview 'git show --color=always (echo {} | cut -d" " -f4)' \ ) - and set commit (echo $commitline | cut -d" " -f1) - and git checkout $commit + and set commit (echo $commitline | cut -d" " -f4) + and echo $commit end function git-checkout-fuzzy @@ -87,6 +87,13 @@ function gittools echo "Not a fuzzy option." return 1 end + case "reset" + set commit (git-commits) + and if test "$argv[2]" = "--hard" + git reset --hard $commit + else + git reset $commit + end case "*" echo "No fuzzy option." return 1