Skip to content

Instantly share code, notes, and snippets.

@jonfazzaro
Forked from alanwillms/git-churn
Last active August 3, 2022 15:21
Show Gist options
  • Save jonfazzaro/56b1f8428fa4703e42e45db0a2f1a467 to your computer and use it in GitHub Desktop.
Save jonfazzaro/56b1f8428fa4703e42e45db0a2f1a467 to your computer and use it in GitHub Desktop.
See the top 10 most changed files in your repository.
#!/bin/bash
#
# Written by Corey Haines
# Scriptified by Gary Bernhardt: https://github.com/garybernhardt/dotfiles/blob/master/bin/git-churn
#
# 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 -rn | awk 'BEGIN {print "count\tfile"} {print $1 "\t" $2}' | head -10
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment