Skip to content

Commit

Permalink
add git churn command
Browse files Browse the repository at this point in the history
  • Loading branch information
victory-sokolov committed Oct 2, 2024
1 parent d6bc0eb commit f9e0be2
Showing 1 changed file with 50 additions and 0 deletions.
50 changes: 50 additions & 0 deletions git/.gitconfig
Original file line number Diff line number Diff line change
Expand Up @@ -235,6 +235,56 @@
unignore = update-index --no-assume-unchanged
ignored = !git ls-files -v | grep "^[[:lower:]]"

# churn: show log of files that have many changes
#
# * Written by (Corey Haines)[http://coreyhaines.com/]
# * Scriptified by Gary Bernhardt
# * Obtained from https://github.com/garybernhardt/dotfiles/blob/master/bin/git-churn
# * Edited for sixarm_git_config repo by Joel Parker Henderson
# * Comments by Mislav http://mislav.uniqpath.com/2014/02/hidden-documentation/
#
# 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`.
#
# It's possible to get valuable insight from history of a project not only
# by viewing individual commits, but by analyzing sets of changes as a whole.
# For instance, git-log-churn compiles stats about which files change the most.
#
# For example, to see where work on an app was focused on in the past month:
#
# $ git churn --since='1 month ago' app/ | tail
#
# This can also highlight potential problems with technical debt in a project.
# A specific file changing too often is generally a red flag, since it probably
# means the file either needed to be frequently fixed for bugs, or the file
# holds too much responsibility and should be split into smaller units.
#
# Similar methods of history analysis can be employed to see which people were
# responsible recently for development of a certain part of the codebase.
#
# For instance, to see who contributed most to the API part of an application:
#
# $ git log --format='%an' --since='1 month ago' app/controllers/api/ | \
# sort | uniq -c | sort -rn | head
#
# 109 Alice Anderson
# 13 Bob Brown
# 7 Carol Clark
#
churn = !git log --all --find-copies --find-renames --name-only --format='format:' "$@" | sort | grep -v '^$' | uniq -c | sort | awk 'BEGIN {print "count\tfile"} {print $1 "\t" $2}' | sort -g


# URL shorthands

[url "ssh://[email protected]/"]
Expand Down

0 comments on commit f9e0be2

Please sign in to comment.