9 ms·
My Git history was a mess of 'update' and 'fix' – so I made AI clean it up
- cube00 11mo agoPerfect for [...] improving repository maintainability. This misses the whole point of using commit messages to record intent. At least with a bunch of "fixed it" commits I know what I'm in for. This only fools yourself and others into thinking the repository was well maintained.
- fka 11mo agoGood point. The purpose of git-rewrite-commits isn’t to "polish" history or rewrite meaning, it’s more of a rescue tool for those chaotic early stages of side projects (like mine) where commits are basically "update again" for months. In those cases, the "intent" was never recorded in the first place, so the AI is just giving some structure and readability to what’s already lost context. It’s not about pretending the repo was well maintained, it’s about making messy histories a bit more understandable for humans (and future me) without rewriting the actual code or meaning.
- MangoToupe 11mo agoI think that's perfectly fine on a branch. I don't see this being deploying on the main branches of any projects of note.
- fka 11mo agoAgreed! I've already added several warnings and disclaimers to the README :) It's really meant to be a "use it once or twice in your lifetime" kind of tool, not something to run on every project. Actually, mostly shouldn't.
- cube00 11mo ago> those chaotic early stages of side projects (like mine) where commits are basically "update again" for months. I don't accept "chaotic early stages of side projects" is a justification for skipping out on writing good quality commit messages. It wouldn't be acceptable in a well managed company so I don't understand why side projects would get a pass to become sloppy. It's your side project and you're free to skip writing commit messages, but you need to own that decision and not blame "those chaotic early stages" I've found taking the time to write good commit messages helps me as I can see what I've tried previously and pull out any older versions if I've found a new direction isn't working for me. It also captures my thought process in case I'm tempted to repeat the sins of the past.
- jghn 11mo agoNot all git messages are equal. My $0.02 is that commit messages I write are for other people. Until I officially hand a branch over for other people's consumption, like a PR, if I'm committing the only reason is because I want to access my code on another machine. I'll put whatever junk I please in those commit messages. But then before I open a PR I'll collapse everything down into 1+ commits each with curated content and appropriate messages.
- cube00 11mo ago> My $0.02 is that commit messages I write are for other people. I write them for my future self. In this context we're talking about a side project which presumably won't have a PR where the commit messages are cleaned up (at least I don't do PRs for my own side projects). If I'm on a branch then I will write junk commits and clean them up before merging to main if I actually manage to get the feature right.
- accoil 11mo agoThis project shows that git messages aren't just for other people as it's an attempt to make terrible messages usable for the person who wrote the code in the first place.
- milkey_mouse 11mo ago> It wouldn't be acceptable in a well managed company so I don't understand why side projects would get a pass to become sloppy. Because no one's paying you, and you owe your users nothing?
- deleted 11mo ago[deleted]
- cube00 11mo ago> Because no one's paying you While I'm certainly getting there, I'm not cynical enough to believe being paid is the only reason to take pride in the quality of your work.
- acjohnson55 11mo agoI'm guessing that the intent is deducible from the diff a pretty large percentage of the time.
- amake 11mo agoReally? Almost always I feel the diff captures only the how, not the why.
- cube00 11mo agoI didn't find it too deducible when OP removed the acknowledgements section after another commenter called them out on the AI slop [1] docs(readme): remove acknowledgments section [2] [1]: https://news.ycombinator.com/item?id=45871258 https://news.ycombinator.com/item?id=45871258 [2]: https://github.com/f/git-rewrite-commits/commit/210ada7ec78fa0fc9295d713772b20470cb947ae https://github.com/f/git-rewrite-commits/commit/210ada7ec78f...
- nikeee 11mo agoYeah, "fixed it" doesn't provide any information that might be hallucinated. Please don't use AI-generated commit messages blindly. Instead, use AI later when reading commit messages. It will have more context (following commits) to see what was actually happening. Having to guess whether a message was hallucinated by an AI won't help. If the message conflicts in its intention with what it isactually doing, you can spot the bug. You won't get that with AI messages. Also, using AI commit messages will freeze it's capabilities in time, when creating the commit. When using AI at reading commit messages, you'll always get the latest options for analyzing the commits. Just because it has more text doesn't make it a better message.
- pton_xd 11mo agoI think this is the beginning of the end of Github. Who has time to read through all these new vibe-coded projects and tools? The READMEs alone are basically essays. You can always get a chuckle or two if you read long enough though, so there's that... " Acknowledgments - OpenAI for providing the GPT API - The conventional commits specification - The git community for powerful version control tools " The future of sharing code is probably dead. Everything is write-only now. Vibe it yourself.
- bakugo 11mo ago> docs(readme): remove acknowledgments section Heh. I wonder if the author asked GPT to remove that section from the readme.
- cube00 11mo agoInteresting that OP removed this [1] from the README and didn't explain why in their commit message or by replying to this comment. [1]: https://github.com/f/git-rewrite-commits/commit/210ada7ec78fa0fc9295d713772b20470cb947ae https://github.com/f/git-rewrite-commits/commit/210ada7ec78f...
- fka 11mo agohonestly, I used to like writing README files before the AI (see my other repos), but I don’t like writing them anymore. GPT does it really well, it may have some mistakes but thankfully, you guys highlight them :)
- greazy 11mo agoI've never seen a single character github username. I thought there was always a minimum number of characters!
- fka 11mo agoI've created my account ~16 years ago :)
- JoshTriplett 11mo agoDo you get a lot of misdirected notifications from people who write the wrong `@`?
- fka 11mo agoit's like, every day ;_;
- gerdesj 11mo agoI used to have a rather short, pithy gmail address back in the day. I binned it for gerdesj@ instead - a username which I use nearly everywhere. A one char ID on a web app is all very well but is the extra hassle worth it?
- fka 11mo agoNope, just seems cool.
- AmbroseBierce 11mo agoYeah, same rationale that Elon shared for renaming Twitter to X, so for good or evil you have that trillionaire mindset pinned down.
- jdhendrickson 11mo ago
- UltraSane 11mo agoGit commit histories should be immutable.
- Smudge 11mo agoonly once pushed or merged to a shared branch.
- fka 11mo agototally agree. in principle, commit histories should be treated as immutable, especially on shared or production branches. this tool is not meant to rewrite public history or alter real project timelines. it's more of a utility for personal or experimental repos (or branches), the kind of messy ones full of "update again" commits that never had a proper history. that's exactly why I built it.
- mathstuf 11mo agoThey are. If you rewrite history, you get a different hash. You can do some shenanigans with git-replace, but those are usually for stitching history across gaps (like hooking pre-publish history to public release for internal archaeology at least. What you actually want is a ban on rewriting tags or accepting branch updates to commits that do not have the current commit as an ancestor. These hooks do exist, but are not on by default (beyond the toilet paper protection of needing --force). You also have to ban deleting branches because otherwise you just delete and push a new one with the same name. Maybe we should store topic branches in repos under refs/topics/ to distinguish integration branches from development/review branches?
- Ferret7446 11mo agoThere's actually a mechanism in Git to add notes to commits after the fact, unsurprisingly called notes
- sunaookami 11mo agohuh TIL. Does GitHub show these notes in the UI?
- 11mo ago
- twodave 11mo agoA great many stiff serious people (in my opinion) are writing very discouraging comments here. Don’t let it get you down. The whole point of hacker culture is to break rules. If that’s what you enjoy then to hell with anyone else’s opinion. I think if you’re more worried about commit history being pristine than the experience of writing code and solving problems then you’ve missed the boat that makes the profession meaningful. Similarly, though, if writing lots of high quality commit messages is your idea of a fun weekend, then go do that and don’t listen to me, either.
- Spivak 11mo agoYeah this project is great, it's exactly the kind of tedious work that should be automated by AI. Some weirdos are going to mythologize commit messages and MR descriptions like they aren't our industry's version of pointless paperwork.
- thfuran 11mo agoThey aren’t pointless. They are (or at least can be) useful documentation. If they’re pointless, why bother generating them with AI instead of just leaving them blank?
- dingnuts 11mo ago[dead]
- Spivak 11mo agoI see it as the same issue as doctor's notes. They're extremely useful but it's a waste of time to actually make the doctor do them. At some places it's a person's whole job to follow around a doctor and do all the busy work for them. I'm not nearly important enough to have an intern write my commit messages but now that AI can do them, and do them extremely well, I'm more than happy to offload the work and get back to the actual work. The AI is far more thorough than I would be and because it takes away nearly all the mental effort the end result is, I think, better.
- h4ny 11mo agoThis feels like a step backwards and now people who never bothered to write proper, appropriate commit messages for others to start with can care even less. I personally don't see what the use case of this is -- you shouldn't even be hired in the first place if you can't even describe the changes you made properly.
- jeena 11mo agoI wish something like this could be a pre-hook which would pre-fill your commit message so that at least I could see a llm commit message instead of ust the Jira-ID because we only force that one. Most of my collegues at work just write the worst commit messages and I don't understand why. They spent so much time comming up with some solution and push it and then don't explain the thinking. Sometimes I'm in a position where I can ask for following fairly simple rules like https://handbook.gnome.org/development/commit-messages.html https://handbook.gnome.org/development/commit-messages.html but most of the time it looks like shit and there is no way of knowing from the commit messages what is going on in that commit. Or perhaps it could be build in into the git-ui like Gerrit or GitLab where you can generate the commit message afterwards from the commit if it's not good enough for you.
- what 11mo agoWhy would you force a ticket number in the commit header? That belongs in a trailer, which you can still enforce and analyze. Also please kill conventional commits, that info should be in a trailer too.
- wilg 11mo agoI use the GitHub Desktop AI commit message generator, which is often better than a bullshit commit message, especially for small projects. It is often sufficient (though too verbose) for simple changes, but does regularly miss the point. But I do agree that you want the commit message to encode your reasoning for the change. If anybody who works on one of these commit message generators is around, some requests: 1. just allow it to take any existing commit message I've already written and expand it based on the diff. that will let me have a starting point or give a crappy but directionally accurate intention explanation 2. look at surrounding code agentically 3. make the commit messages shorter and less fluffy
- austinshea 11mo agoThe value of the space is the ability to glean the commit author's thoughts, at the time they committed it. This is extremely dissimilar to the thoughts of the author. The value of what this emits is already handled by evaluating the diffs in the per-file history. It's not good to throw this sort of thing over the fence, and justifying it by considering it to be wasteful of your precious time doesn't change that. It's better to leave it blank, but a tool like this looks perfect to help someone avoid scrutiny, while simultaneously avoiding providing a tiny depiction of what they were thinking when they committed the change, at the expense of injecting vast amounts of noise.
- AmbroseBierce 11mo agoI would be more interested in an hybrid approach, an AI that when has low confidence in a generated commit message asks the user for their input: "Was this change meant to fix a bug? y/n" and about splitting commits "you changed 6 html files and 1 SQL file, they seem unrelated" should I split that into 2 separated commits? y/n"
- selfhoster11 11mo agoThat actually sounds like a good match for LLMs' ability to do fuzzy intuition and pattern-matching.
- deleted 11mo ago[deleted]
- fka 11mo agothis is a really good idea.
- austinshea 11mo agoI love it. A bit guided of assistance can really make all the difference.
- tga 11mo agoThe value of the space is whatever the user/team finds valuable. You almost had the right idea there: the value of what this emits is really in the summary of diffs. I'm certainly not going to go through each commit and read the diff each time I look at the log, but I still want to understand what happened and be able to find individual commits. If extra information about the author's thoughts is just not available, I'd much rather have summaries than a blank log of "WIP" comments. It's absurd to gatekeep commit messages to only "the thoughts of the author", even if that's what usually goes in there. A good diff summary might even be more useful than a ramble that doesn't mention important changes.
- OfflineSergio 11mo agoThis is what I think AI thrive at. But I'm not sure if its real value or not. We all have repos with fairly clean git history and repos with as the author said "fixes" and "updates". If there was any value in having a clean history in such repos it would have already been clean.
- virajk_31 11mo agoThis is coool, haha. I remember spending time on git rebase to satisfy my OCD.
- procaryote 11mo agoIt would be useful to tag the autogenerated commit messages as [LLM] or something. That way I could at least know the author didn't write this themselves, and decode it accordingly. Humans and LLMs both make mistakes, but they make different styles of mistakes Also, it seems a tool like this would be much better suited to help someone who wants more fluff understand a terse git history, than to rewrite the history. That way, you'd benefit from any later improvements of the model rather than freeze comments at whatever level of slop was the state of the art of the day
- KurSix 11mo agoThis is the perfect product description for how a tool like this should actually work. Not git-rewrite-history, but something like git-explain-commit <hash>. It would take the diff, run it through an LLM at request time, and give you a summary. And yes, with an [Generated by Model XYZ] tag right at the top. This would preserve the integrity of the history while giving us all the power of AI to analyze it, without the downsides of permanent changes and fossilized AI slop
- fka 11mo agothat makes sense!
- KurSix 11mo agoAI-generated commits are useful, as long as they act as a post-processor rather than the author. If the history is already a mess, the tool can structure it chronologically, restore the connections between changes, and describe what they mean. The main thing is that it must not change public SHAs, it needs to mark its own entries as machine-generated, and it should keep the original messages saved somewhere nearby
- bariskayhan 11mo agoI actually see the value here. People love to dunk on devs whom write lazy fix or update commits, but projects aren’t linear. you’re figuring things out as you go. What makes sense at one point can look totally meaningless a few weeks later because your context changed. The real value for me would be adding why something was changed, maybe even referencing future commits so the history makes more sense in hindsight.(of course you can see that changes through commit history)