- Open Ubuntu bash environment shell
- Install dependencies
sudo apt-get update sudo apt-get install git curl
- Create
bin
directory in your home foldermkdir -p ~/bin
- Download
git-churn
script into~/bin
curl -o ~/bin/git-churn https://gist.githubusercontent.com/mscottford/4e030fcc7d88deadf50659056660ae8e/raw/76719af714c06f39a940478ac0345484271d42f1/git-churn
- Mark the churn script as executable
chmod 775 ~/bin/git-churn
- Switch to a cloned copy of the repository
git churn > lifetime-churn.txt git churn --since='3 months ago' > recent-churn.txt
Last active
March 26, 2021 15:42
-
-
Save mscottford/4e030fcc7d88deadf50659056660ae8e to your computer and use it in GitHub Desktop.
Git Churn command
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Scriptified by Gary Bernhardt | |
# Slightly modified by M. Scott Ford | |
# | |
# 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`.) | |
# | |
# you might move this to `~/bin`, mark as executable, and then you'll be able to run it with | |
# `git churn` | |
set -e | |
git log --all --find-renames --find-copies --name-only --format='format:' "$@" | sort | grep -v '^$' | uniq -c | sort -n | awk 'BEGIN {print "count\tfile"} {print $1 "\t" $2}' |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment