Skip to content

Instantly share code, notes, and snippets.

@dspinellis
Created April 2, 2016 11:29
Show Gist options
  • Save dspinellis/a30345d170aed2efc7b31326a30a9ada to your computer and use it in GitHub Desktop.
Save dspinellis/a30345d170aed2efc7b31326a30a9ada to your computer and use it in GitHub Desktop.
Most frequent one-line changes in a Git repository
#!/bin/sh
git log --pretty='SHA %H' --numstat |
awk '/^SHA/ {sha = $2} NF == 3 && $1 == 1 && $2 == 1 {print "git show --oneline --unified=0", sha, "--", $3}'|
sh |
sed -n '/^- /{;s/^-[ \t]*//;h;};/^+ /{s/^+[ \t]*//;H;g;s/\n/$/;p;}' |
sort |
uniq -c |
sort -rn |
head
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment