Show HN: Tool to Automatically Create Organized Commits for PRs
The tool sends the diff of your git branch against a base branch to an LLM provider. The LLM provider responds with a set of suggested commits with sensible commit messages, change groupings, and descriptions. When you explicitly accept the proposed changes, the tool re-writes the commit history on your branch to match the LLM's suggestion. Then you can force push your branch to your remote to make it match.
The default AI provider is your locally running Ollama server. Cloud providers can be explicitly configured via CLI argument or in a config file, but keeping local models as the default helps to protect against unintentional data sharing. The tool always creates a backup branch in case you need to easily revert in case of changing your mind or an error in commit re-writing. Note that re-writing commit history to a remote branch requires a force push, which is something your team/org will need to be ok with. As long as you are working on a feature branch this is usually fine, but it's always worth checking if you are not sure.
I’m all for proper commit messages, but only if they add clarity, not take it away.
[1] https://github.com/jj-vcs/jj
I make use of interactive partial commits using Pycharm when a single file has changes related to different ideas and rewrite history for clarity.
It does matter to me if someone else has gone to this trouble. And it is sometimes a tip off if a person is seemingly sloppy in commit history.
It makes sense that this project exists but I’m also glad it didn’t when I was learning to work in professional environments.
So,where is the noise if it can be hidden but also used to get additional information on code changes?
I couldn’t care less what changes were introduced in a particular commit (what for? Debugging? Your features should be small enough that debugging them shouldn’t be a pita anyway)
I think the intent is that it be up to the org to decide whether they’ll accept a stream of commits to merge or squash merge after approval.
1. Always squash and merge 2. But have tidy commits 3. So your squashed commit has a useful list of what is in the commit
One thing I would love is if I could give it a hint and have it extract out certain types of changes into its own branch that could split into a new PR.
I often find myself adding a new, re-usable component or doing a small refactor in the middle of a project. When you're a few commits into a project and start doing side-quests, it's super annoying to untangle that work.
The options are one of:
1. A mega PR (which everybody hates) 2. Methodologically untangling the side quest post-hoc 3. Not doing it
In principle, the "right" thing to do would be to go checkout main, do the side quest, get it merged and then continue.
But that's annoying and I'd rather just jam through, have AI untangle it, and then stack the commits (ala Graphite).
It's easy to verbally explain what stuff is side-quest vs. main quest but it's super annoying to actually do the untangling.
Maybe this tool magically can do that... but I do wonder if some context hints from the dev would help / make it more effective.
Alternatively, if you don't like rebasing, you can merge the side quest branch into your project branch instead.
Either way, you don't have to wait for the side quest to get merged.
One huge advantage of squashing branches is if you see a commit in a `git blame` you might have an idea of where it came from within GitHub/Linear/other systems.
Think these tools together make non-squash PRs much easier to deal with for people who don't want to spend the extra time tidying things up.
BTW, really excited to see this. I was thinking about the concept in a thread last year https://news.ycombinator.com/context?id=40765134
"I look forward to the day that I can run a local LLM (for confidentiality reasons) to automatically reorganize commits within my PR. Should be very safe compared to generating code or merging/rebasing other code since it is just changing the grouping of commits and the final code should be unchanged."
How did you collate hundreds or thousands of examples of commits being split up and how did you score the results LLMs gave you? Or did it take more than that?