Add git churn and what-the-hell-just-happened

Files copied from https://github.com/garybernhardt/dotfiles.git
This commit is contained in:
Fernando Schauenburg 2016-02-02 01:02:27 +01:00
parent f7b78bcda7
commit d6eb384c91
2 changed files with 44 additions and 0 deletions

23
bin/git-churn Executable file
View file

@ -0,0 +1,23 @@
#!/bin/bash
#
# Written by Corey Haines
# Scriptified by Gary Bernhardt
#
# Put this anywhere on your $PATH (~/bin is recommended). Then git will see it
# and you'll be able to do `git churn`.
#
# Show churn for whole repo:
# $ git churn
#
# Show churn for specific directories:
# $ git churn app lib
#
# Show churn for a time range:
# $ git churn --since='1 month ago'
#
# (These are all standard arguments to `git log`.)
set -e
git log --all -M -C --name-only --format='format:' "$@" | sort | grep -v '^$' | uniq -c | sort -n | awk 'BEGIN {print "count\tfile"} {print $1 "\t" $2}'

View file

@ -0,0 +1,21 @@
#!/bin/bash
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