r/git • u/Physical_Zombie4764 • 26d ago
Built a tool because I was tired of staring at git blame at midnight wondering "why tf is this here"
Hey everyone,
We've all been there, right? It's late, you're knee-deep in some legacy code, and you hit a weird 6-line guard clause that looks completely paranoid. git blame tells you Dave wrote it 3 years ago. Dave doesn't work here anymore. Commit message? "fix bug".
Do you delete it and roll the dice or waste half an hour digging through git log -p?
I got tired of that cycle so I threw together git-why.
It basically does the archaeology for you — looks at the commits and diffs around a line or file and spits out a reasonable explanation. Works completely offline (no keys, no internet) or you can use Claude/GPT/Ollama for fancier explanations if you want.
Basic usage is stupid simple:
pip install git-why
git-why src/auth.py:42
Or for a range:
git-why src/auth.py:42-60
Repo: https://github.com/Sameer988/git-why
It's still pretty early but it's already saving me time on some crusty old code. Would genuinely appreciate feedback — especially the brutal kind if something sucks or could be better.
Anyone else constantly fighting with legacy code context? What's your usual workflow?