Skip to content

Instantly share code, notes, and snippets.

@erochest
Created November 9, 2018 18:30
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 erochest/9fd48fd37becad6e988799dbb2510f78 to your computer and use it in GitHub Desktop.
Save erochest/9fd48fd37becad6e988799dbb2510f78 to your computer and use it in GitHub Desktop.
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