From dd256a24f423f41341334c3b7194d45c84da7b21 Mon Sep 17 00:00:00 2001 From: Ivan Malison Date: Sun, 28 Apr 2024 17:17:57 -0600 Subject: [PATCH] [git] Add find-merge --- dotfiles/gitconfig | 1 + 1 file changed, 1 insertion(+) diff --git a/dotfiles/gitconfig b/dotfiles/gitconfig index 13f6622d..e3b28c65 100644 --- a/dotfiles/gitconfig +++ b/dotfiles/gitconfig @@ -50,6 +50,7 @@ tb = rev-parse --abbrev-ref --symbolic-full-name @{u} untracked = "!u() { git status -s | grep "??" | awk '{print $2}'; }; u" which-branch = "!wb() { b="$(git symbolic-ref HEAD)" && echo ${b#refs/heads/}; }; wb" + find-merge = "!sh -c 'commit=$0 && branch=${1:-HEAD} && (git rev-list $commit..$branch --ancestry-path | cat -n; git rev-list $commit..$branch --first-parent | cat -n) | sort -k2 -s | uniq -f1 -d | sort -n | tail -1 | cut -f2'" [core] # Use custom `.gitignore` and `.gitattributes`