diff --git a/site-modules/core/files/bin/git-find-merge b/site-modules/core/files/bin/git-find-merge new file mode 100755 index 0000000..139658f --- /dev/null +++ b/site-modules/core/files/bin/git-find-merge @@ -0,0 +1,7 @@ +#!/bin/bash +# See: https://stackoverflow.com/questions/8475448/find-merge-commit-which-includes-a-specific-commit + +commit=$1 +branch=${2:-HEAD} +candidates=$(git rev-list $commit..$branch --ancestry-path | cat -n; git rev-list $commit..$branch --first-parent | cat -n) +echo "$candidates" | sort -k2 -s | uniq -f1 -d | sort -n | tail -1 | cut -f2