Created
April 8, 2026 12:26
-
-
Save aeimer/8edc0b25f3197c0986d3f2618f036f63 to your computer and use it in GitHub Desktop.
git repo state analysis inspired by https://piechowski.io/post/git-commands-before-reading-code/
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
| #!/usr/bin/env bash | |
| set -eu | |
| # DEBUG MODE | |
| # set -x | |
| # Usage after copying to PATH-able directory: | |
| # cd into a git repository and run: git-repo-analysis.sh | |
| HEADN=20 | |
| SINCE="1 year ago" | |
| echo "Source: https://piechowski.io/post/git-commands-before-reading-code/" | |
| echo | |
| echo "-----" | |
| echo "HEADN: $HEADN" | |
| echo "SINCE: $SINCE" | |
| echo "-----" | |
| echo | |
| echo "#########################" | |
| echo "# What Changes the Most #" | |
| echo "#########################" | |
| git log --format=format: --name-only --since="$SINCE" \ | |
| | sort | uniq -c | sort -nr | head -n "$HEADN" | |
| echo | |
| echo "##################" | |
| echo "# Who Built This #" | |
| echo "##################" | |
| git shortlog -sn --no-merges | cat | |
| echo | |
| echo "#########################" | |
| echo "# Where Do Bugs Cluster #" | |
| echo "#########################" | |
| git log -i -E --grep="fix|bug|broken" --name-only --format='' \ | |
| | sort | uniq -c | sort -nr | head -n "$HEADN" | |
| echo | |
| echo "#########################################" | |
| echo "# Is This Project Accelerating or Dying #" | |
| echo "#########################################" | |
| git log --format='%ad' --date=format:'%Y-%m' | sort | uniq -c | |
| echo | |
| echo "######################################" | |
| echo "# How Often Is the Team Firefighting #" | |
| echo "######################################" | |
| git log --since="$SINCE" \ | |
| --date=short \ | |
| --pretty=format:'%ad %h %s' \ | |
| | grep -iE 'revert|hotfix|emergency|rollback' | sort |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment