Categories
Uncategorized

5 useful git commands on code bases (repost)

Five useful git commands to run on every repo. I like the idea!

Source: https://piechowski.io/post/git-commands-before-reading-code (Note: reposting didn’t work?!)

# Most changes
git log --format=format: --name-only --since="1 year ago" | sort | uniq -c | sort -nr | head -20

# Who built it (beware of squashed commits)
git shortlog -sn --no-merges

# Clusters of bugs
git log -i -E --grep="fix|bug|broken" --name-only --format='' | sort | uniq -c | sort -nr | head -20

# Accelerating or dying
git log --format='%ad' --date=format:'%Y-%m' | sort | uniq -c

# Firefighting
git log --oneline --since="1 year ago" | grep -iE 'revert|hotfix|emergency|rollback'

# Author: Ally Piechowski

Leave a Reply

Your email address will not be published. Required fields are marked *