From d6eb384c912b5b2f1a5c5b794ef42d730d4a64f2 Mon Sep 17 00:00:00 2001 From: Fernando Schauenburg Date: Tue, 2 Feb 2016 01:02:27 +0100 Subject: [PATCH] Add git churn and what-the-hell-just-happened Files copied from https://github.com/garybernhardt/dotfiles.git --- bin/git-churn | 23 +++++++++++++++++++++++ bin/git-what-the-hell-just-happened | 21 +++++++++++++++++++++ 2 files changed, 44 insertions(+) create mode 100755 bin/git-churn create mode 100755 bin/git-what-the-hell-just-happened diff --git a/bin/git-churn b/bin/git-churn new file mode 100755 index 0000000..a44f20a --- /dev/null +++ b/bin/git-churn @@ -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}' + + diff --git a/bin/git-what-the-hell-just-happened b/bin/git-what-the-hell-just-happened new file mode 100755 index 0000000..aa91319 --- /dev/null +++ b/bin/git-what-the-hell-just-happened @@ -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 +