From 521e4de26d6d31e3e12dd4cb792f4d85be36d3a6 Mon Sep 17 00:00:00 2001 From: Sameer Rahmani Date: Thu, 13 Jul 2023 10:03:51 +0100 Subject: [PATCH] Modify some of the git functions to use fzf --- lib/git.zsh | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/lib/git.zsh b/lib/git.zsh index b1d7693..4152ff0 100755 --- a/lib/git.zsh +++ b/lib/git.zsh @@ -152,7 +152,7 @@ function git_commits_from() { } function git_reset_branch_commits() { - git reset $(git merge-base $1 $(git branch --show-current)) + git reset $(git merge-base "$1" $(git branch --show-current)) } function git_uncommit() { @@ -161,15 +161,16 @@ function git_uncommit() { } function git_show_branch_filter() { - git show $(g log --pretty=format:"%h %an %ad %s" origin/HEAD..HEAD |filter|cut -d ' ' -f 1 |xargs) + git show $(g log --pretty=format:"%h %an %as %s" origin/HEAD..HEAD |fzf --reverse --height 40%|cut -d ' ' -f 1 |xargs) } function git_show_filter() { - git show $(g log --pretty=format:"%h %an %ad %s" |filter|cut -d ' ' -f 1 |xargs) + git show $(g log --pretty=format:"%h %an %as %s" |fzf --reverse --height 40%|cut -d ' ' -f 1 |xargs) } function git_fixup() { - git commit "$1" --fixup $(g log --pretty=format:"%h %an %ad %s" origin/HEAD..HEAD |filter|cut -d ' ' -f 1 |xargs) + #git commit "$1" --fixup $(g log --pretty=format:"%h %an %ad %s" origin/HEAD..HEAD |filter|cut -d ' ' -f 1 |xargs) + git commit "$@" --fixup $(g log --pretty=format:"%h %an %ad %s" --reverse origin/HEAD..HEAD |fzf --reverse --height 40%|cut -d ' ' -f 1 |xargs) } #this is unlikely to change so make it all statically assigned