Last active
February 3, 2023 07:56
-
-
Save Alpha59/4e9cd6c65f7aa2711b79 to your computer and use it in GitHub Desktop.
A very very slow one-liner that goes through a git blame and sees how many lines were contributed by each author.
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
git ls-files -z | xargs -0n1 git blame -wfn | grep -v "test" | grep "\.(js|html)[^o]\s" | perl -n -e '/\((.*)\s[\d]{4}\-/ && print $1."\n"' | awk '{print $1" "$2" "$3}' | sort -f | uniq -c | sort -nr | |
# Lists the number of lines that an author has contributed to the code base. | |
# This also filters for !test and ==.js or .html (which was useful for this particular run) | |
# A Django version of the same thing: | |
git ls-files -z | xargs -0n1 git blame -wfn | grep -v "test" | grep -v "fixture" | grep -v "json" | grep -v "gpg" | grep -v ".md" | grep -v "initial_schema" | grep -v "fonts" | grep -v "min." | grep -v "migrations" | grep -v "images" | grep -v "/bootstrap" | grep -v "debug" | grep -v "/img" | grep -v "vendor" | perl -n -e '/\((.*)\s[\d]{4}\-/ && print $1."\n"' | awk '{print $1" "$2" "$3}' | sort -f | uniq -c | sort -nr |
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
git branch --merged | grep -v `git rev-parse --abbrev-ref HEAD` | xargs git branch -d | |
# checkout your dev branch, and then clean up your local by running this to remove all merged branches. |
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
git ls-files -z | xargs -0n1 git blame -wfn | awk '/<author>/{print $0}' | |
# I suggest only using this if the author has a small number of lines listed above. | |
# I also adjusted it to include the file name and line number. |
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
git ls-files -z | xargs -0n1 git blame -wfn | awk '/<author>/{print $2}' | sort -f | uniq -c | sort -nr | |
# Lists out files that have been altered by a given author (including number of lines changed in that file). |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment