From: Jacob Casper Date: Thu, 19 Mar 2020 18:54:16 +0000 (-0500) Subject: Initial commit X-Git-Url: https://git.jacobcasper.com/?p=blame.git;a=commitdiff_plain;h=237c6423e112d1ab06ca9aa783018094fc536d48 Initial commit --- 237c6423e112d1ab06ca9aa783018094fc536d48 diff --git a/Makefile b/Makefile new file mode 100644 index 0000000..d62189f --- /dev/null +++ b/Makefile @@ -0,0 +1,4 @@ +install: + ln -fF blame.sh /usr/local/bin/blame +uninstall: + rm -f /usr/local/bin/blame diff --git a/README.md b/README.md new file mode 100644 index 0000000..9a394a1 --- /dev/null +++ b/README.md @@ -0,0 +1,7 @@ +# Blame + +A shell script to see who should _really_ own a file in your `git` project. + +## Usage + +`blame [file]` diff --git a/blame.sh b/blame.sh new file mode 100755 index 0000000..6c32e2e --- /dev/null +++ b/blame.sh @@ -0,0 +1,2 @@ +#!/bin/sh +git blame --line-porcelain -- $1 | awk '/^author /' | awk '{$1 = ""; author=substr($0, 2); counts[author] += 1} END { for (author in counts) {print counts[author],author,counts[author],counts[author]/NR*100"%"} }' | sort -nr -k 1 | awk '{$1 = ""; print $0}'