dotfiles/bin/git-churn

28 lines
646 B
Bash
Executable file

#!/bin/sh
#
# List files with commit count.
#
# Based on: https://github.com/garybernhardt/dotfiles/blob/main/bin/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`.)
#
exec git log --all \
--find-copies \
--find-renames \
--name-only \
--format='format:' \
"$@" \
| sort \
| grep -v '^$' \
| uniq -c \
| sort -n \
| awk 'BEGIN {print "count\tfile"} {print $1 "\t" $2}'