After doing a \"simple\" merge (one without conflicts), git show usually only shows something like
commit 0e1329e551a5700614a2a34d8101e92fd9f2ca
I built a general-purpose approach to doing various operations on a merge's commits.
Step One: Add an alias to git by editing ~/.gitconfig:
[alias]
range = "!. ~/.githelpers && run_on_merge_range"
Step Two: In ~/.githelpers, define a bash function:
run_on_merge_range() {
cmd=$1; shift
commit=$1; shift
range=$(git show $commit | grep Merge: | awk '{print $2 "..." $3}')
echo "git $cmd $range $@"
if [ -z $range ]; then
echo "No merge detected"
exit 1
fi
git $cmd $range $@
}
Step Three: Profit!
git range log --oneline
git range diff --reverse -p
git range diff --name-only
There is probably a LOT of room for improvement here, I just whipped this together to get past an annoying situation. Feel free to mock my bash syntax and/or logic.