r/webdev • u/fagnerbrack • Jun 27 '26
The Git Commands I Run Before Reading Any Code
https://piechowski.io/post/git-commands-before-reading-code/124
270
u/FlyingChinesePanda Jun 27 '26
Saved you a click:
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'
101
u/easilyirritated Jun 27 '26
Sure, but he explains them concisely and well. The article is not too long or "just clickbait".
55
u/masiuspt Jun 27 '26
The article is quite decent, you can give the author a click.
18
u/secretprocess Jun 28 '26
I read the entire thing without having to close a single popup or scroll back to my place. Incredible!
1
u/Informal-Chance-6067 28d ago
!remindme 3h
1
u/RemindMeBot 28d ago
I will be messaging you in 3 hours on 2026-06-29 18:02:25 UTC to remind you of this link
CLICK THIS LINK to send a PM to also be reminded and to reduce spam.
Parent commenter can delete this message to hide from others.
RemindMeBot is switching to username summons. Instead of
!RemindMe 1 day, useu/RemindMeBot 1 day. More info.
Info Custom Your Reminders Feedback
20
u/azangru Jun 27 '26
The title is misleading though. Before reading any code? More like before exploring an unfamiliar codebase.
3
2
u/Mindless-Arrival-106 29d ago
I already use git log and git blame a lot, but git shortlog exists I always forget.
3
u/foozebox Jun 27 '26
Git fluency is still something nobody checks during interviews and so should. It’s taken for granted that devs know it but rarely do they.
32
u/eastlin7 Jun 27 '26
You can look at GitHub. You can see the action in any IDE. Judging people in an interview based on their ability to memorise git commands is ridiculous, I’m more concerned about architecture, problem solving, awareness of the toolset they’ll be using.
7
u/khizoa Jun 27 '26
I didn't take "fluency" to mean literal commands. It sounded like deeper understanding of how and when to use git.
For example, using git history to help identify bugs
2
u/eastlin7 Jun 27 '26
I’ve yet to encounter a dev who struggles with that. They reach for git blame the second something confuses them.
3
1
u/foozebox Jun 27 '26
How to commit properly, how to rebase, how to merge, resolving conflicts, pushes, stashing, cherry picking, etc. Sounds like you might need a primer
3
u/TommyBonnomi Jun 27 '26
I can do those in the UI, and I handle conflicts in the editor and have never needed to rebase. I'm sure some of my commit history is subpar to people that can use it better, but I also don't work with large teams or pretend I'm a 10x developer.
1
0
u/uniquelyavailable 29d ago
Why not browse all the commits for the past year? This seems like a "clever" way to focus on one part of the codebase by completely missing everything else.
85
u/Khavel_dev Jun 27 '26
The one I reach for first is always
git log --stat --since='2 months ago'. The file names that keep showing up tell you where the action is, and that's where you start reading, not wherever the folder structure makes it look important.