From 93542a3506fe9abb916118a2e4d341ea73c0b559 Mon Sep 17 00:00:00 2001 From: Sameer Rahmani Date: Thu, 24 Nov 2022 11:04:03 +0000 Subject: [PATCH] Add two new git functions for 'fixup' and 'show' using filter --- lib/git.zsh | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/lib/git.zsh b/lib/git.zsh index 7bb22de..e185677 100755 --- a/lib/git.zsh +++ b/lib/git.zsh @@ -155,11 +155,19 @@ function git_reset_branch_commits() { git reset $(git merge-base $1 $(git branch --show-current)) } -function git-uncommit() { +function git_uncommit() { git reset --soft HEAD~1 git restore --staged . } +function git_show_filter() { + git show $(g log --pretty=format:"%h %an %ad %s" origin/HEAD..HEAD |filter|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) +} + #this is unlikely to change so make it all statically assigned POST_1_7_2_GIT=$(git_compare_version "1.7.2") #clean up the namespace slightly by removing the checker function