git log
Use Git Log to Learn About a Codebase
·
I'm always interested in ways to get familiar with a codebase faster. This post goes over how to use git log in multiple ways to get an overview of the project and the company.
Five git log commands that diagnose a new codebase before you open a single file: code churn hotspots, bus factor, bug clusters, and crisis patterns.
Here are the commands, for quick reference:
# What changes the most?
git log --format=format: --name-only --since="1 year ago" | sort | uniq -c | sort -nr | head -20
# Who built this?
git shortlog -sn --no-merges
# Where do bugs cluster?
git log -i -E --grep="fix|bug|broken" --name-only --format='' | sort | uniq -c | sort -nr | head -20
# Is this project accelerating or dying?
git log --format='%ad' --date=format:'%Y-%m' | sort | uniq -c
# How often is the team firefighting?
git log --oneline --since="1 year ago" | grep -iE 'revert|hotfix|emergency|rollback'