Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
Walks through the merge commits from the last day, and the diffs of what was merged.
#!/bin/bash
since=yesterday
branch=$(git branch | grep \* | cut -d ' ' -f2)
while (( "$#" )); do
case "$1" in
-s|--since)
since="$2"
shift 2
;;
--)
shift
break
;;
*)
branch="$1"
shift
;;
esac
done
for commit_hash in $(git --no-pager log --since ${since} --merges --format="%H" ${branch}); do
parents=($(git --no-pager log $commit_hash -1 --format="%P"))
git --no-pager log -1 --format=fuller $commit_hash
git --no-pager diff "${parents[0]}"..."${parents[1]}"
echo
done
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment