Add helpful MR-related git aliases
Lee shared Alex Ives's MR aliases in Slack:
[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'"
merge-ancestry = "!sh -c 'git log --reverse $0..master --ancestry-path --merges'"
file-merge-ancestry = "!sh -c 'last_comm=$(git log -1 --pretty=format:%H $0) && git merge-ancestry $last_comm'"
I'm making this issue to both preserve this and add it to the project.
We could make them bash commands that are run once doing the following:
git config --global 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'"
git config --global alias.show-merge "!sh -c 'merge=$(git find-merge $0 $1) && [ -n \"$merge\" ] && git show $merge'"
git config --global alias.merge-ancestry "!sh -c 'git log --reverse $0..master --ancestry-path --merges'"
git config --global alias.file-merge-ancestry "!sh -c 'last_comm=$(git log -1 --pretty=format:%H $0) && git merge-ancestry $last_comm'"
Edited by Matthew Badeau