unixorn/git-extra-commands

View on GitHub
bin/git-what-the-hell-just-happened

Summary

Maintainability
Test Coverage
#!/usr/bin/env bash
# Originally from Gary Bernhardt's dotfiles
# https://github.com/garybernhardt/dotfiles/blob/master/bin/git-what-the-hell-just-happened

set -e

ref=${1:-"HEAD"}

old=$ref@{1}
new=$ref

log() {
    git log --graph --pretty=short -1 "$1"
}

echo "Old revision:"
log "$old"
echo
echo "New revision:"
log "$new"
echo
echo "Changes:"
git diff --stat --summary "$new" "$old"