feat(git): add git stats function

This commit is contained in:
Victor Westerlund 2026-04-08 18:49:40 +02:00
parent b7e7151bb0
commit fc889cacd4
Signed by: vlw
GPG key ID: 5DAF14C317AA7719
2 changed files with 32 additions and 0 deletions

View file

@ -269,6 +269,10 @@ gitf () {
git push -f git push -f
;; ;;
"s")
/bin/bash ~/.local/bin/scripts/git_stats.sh
;;
# Update all git submodules in this repo. "sd" for submodule download. # Update all git submodules in this repo. "sd" for submodule download.
"sd") "sd")
# Only supports "master" as branch for now. This could cause unexpected results if a tracked submodule has a different branch or location name # Only supports "master" as branch for now. This could cause unexpected results if a tracked submodule has a different branch or location name

28
.local/bin/scripts/git_stats.sh Executable file
View file

@ -0,0 +1,28 @@
#!/bin/sh
{
echo "# What Changes the Most"
echo "---------------------------------------"
git log --format=format: --name-only --since="1 year ago" | sort | uniq -c | sort -nr | head -20
echo ""
echo "# Who Built This"
echo "---------------------------------------"
git shortlog -sn --no-merges
echo ""
echo "# Where Do Bugs Cluster"
echo "---------------------------------------"
git log -i -E --grep="fix|bug|broken" --name-only --format='' | sort | uniq -c | sort -nr | head -20
echo ""
echo "# Is This Project Accelerating or Dying"
echo "---------------------------------------"
git log --format='%ad' --date=format:'%Y-%m' | sort | uniq -c
echo ""
echo "# How Often Is the Team Firefighting"
echo "---------------------------------------"
git log --oneline --since="1 year ago" | grep -iE 'revert|hotfix|emergency|rollback'
echo ""
} | less