Created
November 19, 2012 08:25
-
-
Save vderyagin/4109561 to your computer and use it in GitHub Desktop.
git churn
This file contains 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
#! /usr/bin/env ruby | |
IO.popen('git log --name-only --pretty=format:""') | |
.readlines | |
.map(&:chomp) | |
.reject(&:empty?) | |
.select { |file| File.exists?(File.expand_path(file, ENV['GIT_WORK_TREE'])) } | |
.each_with_object(Hash.new(0)) { |file, changes| changes[file] += 1 } | |
.to_a | |
.sort_by(&:last) | |
.reverse_each { |file, churn| puts "#{churn.to_s.ljust 5} #{file}" } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment