Created
April 8, 2026 16:43
-
-
Save mcpar-land/71a3dbc9ef50aa1f5c6420dc9d79990c to your computer and use it in GitHub Desktop.
Git repository analysis commands
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
| # https://piechowski.io/post/git-commands-before-reading-code/ | |
| cd ${1?.} | |
| echo "# Most changed files, last year" | |
| echo '```' | |
| git log --format=format: --name-only --since="1 year ago" \ | |
| | sort \ | |
| | uniq -c \ | |
| | sort -nr \ | |
| | head -20 | |
| echo '```' | |
| echo | |
| echo "# Contributors by commit count" | |
| echo '```' | |
| git shortlog -sn --no-merges | |
| echo '```' | |
| echo | |
| echo "# Commits with bug keywords" | |
| echo '```' | |
| git log -i -E --grep="fix|bug|broken" --name-only --format='' | sort | uniq -c | sort -nr | head -20 | |
| echo '```' | |
| echo | |
| echo "# Commits by month" | |
| echo '```' | |
| git log --format='%ad' --date=format:'%Y-%m' | sort | uniq -c | |
| echo '```' | |
| echo | |
| echo "# Revert and hotfix frequency" | |
| echo '```' | |
| git log --oneline --format='%ad %s' --date=format:'%Y-%m-%d' --since="1 year ago" | grep -iE 'revert|hotfix|emergency|rollback' | |
| echo '```' |
Author
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Inspired by this post, I assembled all the commands in that post into a single script that outputs a markdown-compatible report. Pipe it into a markdown file or a markdown pretty-printer like
glow.