Skip to content

Instantly share code, notes, and snippets.

@avit
Created September 19, 2018 20:42
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save avit/7b965dd3a5878b9dd8f9505421eb3cc0 to your computer and use it in GitHub Desktop.
Save avit/7b965dd3a5878b9dd8f9505421eb3cc0 to your computer and use it in GitHub Desktop.
Commands to find when a commit was merged
[alias]
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'"
show-merge = "!sh -c 'merge=$(git find-merge $0 $1) && [ -n \"$merge\" ] && git show $merge'"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment