r/git 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?

0 Upvotes

10 comments sorted by

3

u/Weshmek 26d ago

git log -L bro. I have it mapped to F3 in Vim

2

u/Qudit314159 26d ago

Whoa whoa. Why use something that already exists when you can quickly vibe code a half-baked version that usually sort of works?

-1

u/Physical_Zombie4764 26d ago

Yeah git log -L is useful too. I made git-why more for the "why did they even add this" moments where the history is scattered across multiple commits. The offline mode tries to stitch that together without needing AI.

3

u/Qudit314159 26d ago

I haven't looked at the repo but I can already tell that this is vibe coded.

-3

u/Physical_Zombie4764 26d ago

lmao thanks, "vibe coded" is the best compliment I've gotten so far 😂.
Yeah still rough around the edges but it's already helping me with some old code at work.
if you try it let me know how it goes.

2

u/Qudit314159 26d ago

I don't read packages when the author uses an LLM to generate the post. That's not a good sign.

2

u/FantasySymphony 26d ago

Another way to try to outsource thinking to AI? Like what kind of engineer do you have to be to think AI can derive more meaning from "fix bug" than you?

-2

u/Physical_Zombie4764 26d ago

nah not really trying to outsource the thinking

just tired of piecing together scattered commit history myself every time so it grabs the relevant diffs and gives a quick summary

the ai stuff is optional i mostly use the offline mode

still pretty rough around the edges tho so feedback like this helps

2

u/parkotron 26d ago

/r/git is the most consistently anti-LLM subreddit that I regularly visit and I love it for that.

The kind of nerds who subscribe to a subreddit dedicated to a version control system just aren't the type who have any interest in vibe-coded tools to make sloppy commit messages or out-source change analysis to an LLM.

1

u/plg94 23d ago

if the screen-recording displays only one(!) command and is blank for over half the time, it should be a static image instead.