frontpage.
newsnewestaskshowjobs

Made with ♥ by @iamnishanth

Open Source @Github

Open in hackernews

Show HN: Tool to Automatically Create Organized Commits for PRs

https://github.com/edverma/git-smart-squash
37•edverma2•4h ago
I've found it helps PR reviewers when they can look through a set of commits with clear messages and logically organized changes. Typically reviewers prefer a larger quantity of smaller changes versus a smaller quantity of larger changes. Sometimes it gets really messy to break up a change into sufficiently small PRs, so thoughtful commits are a great way of further subdividing changes in PRs. It can be pretty time consuming to do this though, so this tool automates the process with the help of AI.

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.

Comments

iandanforth•3h ago
Can I suggest, don't do this? The sustainable unit of code modification is the ticket, not the commit. When you're ready to merge to main, squash all commits into one that takes the ticket title as its commit message and appends the ticket description as its description. This aligns code changes with planned, scoped, and documented units of work. Anything more granular than that quickly becomes noise. By following the above pattern your main commit history becomes a clean, consistent log of tickets being completed, each linking directly back to your ticket management system.
CityOfThrowaway•3h ago
The best practice that I've seen done (and enjoy) is:

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

bredren•2h ago
This project seems focused on preparing branches for review by giving them clearly communicated commit histories.

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.

Fire-Dragon-DoL•1h ago
I don't get it. Assuming your commits have meaningful messages and description, why squashing them? You can use git log --merges-only (I think that's the arg name) and all the sub commit are hidden, however you can still search through them to get a clear idea of why something was refactored a certain way.

So,where is the noise if it can be hidden but also used to get additional information on code changes?

baq•1h ago
If you need to use —-merges-only you might as well squash everything, why bother.
Fire-Dragon-DoL•1h ago
I use merges-only when I need to look at the history "index" and I use the full history when I need to find out why a certain line was changed, kinda like a book has an index but there are also all the chapters with all the content
dakiol•15m ago
In my experience, when people need to know what commit belongs to what code, is the IDE the main driver: you see the line of code in the editor and automatically know what commit introduced it (e.g., via the git integration in the gutter). Typically you want to know as well all the other lines of code that were committed together (e.g., what does it take to implement feature X? Ah yeah, all these 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)

collingreen•9m ago
I don't agree with most of this but my good faith take is that my experience trends closer to your opinion the more stable and large a codebase is plus how dedicated and multidisciplinary the team is. I disagree the most for young, volatile projects with small eng-only teams that are responsible for many projects at once.
CityOfThrowaway•3h ago
I haven't tried this yet (though I plan to).

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.

edverma2•2h ago
Interesting! I’ve faced the same problem where I have a mega PR and spend a lot of time breaking that up into separate PRs. I agree that what you are suggesting is a different but related problem to what this tool currently solves. I’ll start thinking through how this would look, and I’ll go ahead and make a GitHub issue if you or anyone else wants to start a discussion there.
CityOfThrowaway•2h ago
Awesome!
2YwaZHXV•2h ago
I haven't tried it much but this seems like precisely the problem gitbutler is trying to solve
matijsvzuijlen•1h ago
In such cases, I generally checkout main, do the side quest, and rebase my original branch on top of it. Then, I can just continue without waiting for the side quest to be merged. Depending on the situation, I may make a separate PR for the side quest, but I don't have to wait for it to get merged.

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.

bckr•3h ago
I was just talking about writing a tool like this. Bookmarked. Thanks.
scottgg•2h ago
Since moving to jj[1] as a git-compatible alternative, I’ve found it so easy to make clean commits I do it by default for everything - usually 1/ refactor 2/impl, 3/ docs. Because you can always just “jj new” on top of an existing change then squash it down and get automatic rebase past that point it’s quick to keep things organised and makes review life suck less.

[1] https://github.com/jj-vcs/jj

bredren•2h ago
This is a cool idea, though part of what keeps my work organized and my understanding of my own changes is to do the manual preparation of a series of logical commits.

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.

esafak•2h ago
I want something that takes a big commit and splits it up!
aaronbrethorst•1h ago
Very cool, I’ve been looking for something like this, but I’d love to see this flipped around and become an MCP tool that can be consumed by an LLM instead of requiring an API key.
Cthulhu_•1h ago
In our org we squash all commits into one anyway, the main commit title is based on the title of the merge request. We also have an AI code review tool set up (which I usually ignore because there's a lot of extraneous information) that suggests a new title, given that the people making the MR often don't consider that the title ends up in the changelog, becoming the one line that will be used by people using the library to decide whether they need to do something.
jaredsohn•1h ago
I didn't look at things too closely, but it would be nice if this each commit would include a ticket number from the branch (such as a linear id) and/or pr id in each commit for people who do not squash.

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.

figmert•59m ago
Surely this would be the job of a prepare-commit-msg/commit-msg hook?
jaredsohn•36m ago
Yeah, could be a separate tool. Another tool could be a GitHub action that checks if the ids are in each commit; I built a prototype of that for work but it needs some polish and permission for a more general release.

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."

kelseydh•32m ago
I would love Github to integrate this, as that is typically where I am writing my squash commit messages (when merging Pull Requests).
amenghra•14m ago
https://graphite.dev/ provides a way to stack PRs, it's been discussed on HN in the past (e.g. https://news.ycombinator.com/item?id=30681308).

How to Solve Cybersecurity Once and for All [pdf]

https://ieeexplore.ieee.org/stamp/stamp.jsp?arnumber=11038978
1•ArneVogel•1m ago•0 comments

BBC threatens legal action against AI startup Perplexity over content scraping

https://www.ft.com/content/b743d401-dc5d-44b8-9987-825a4ffcf4ca
1•mmarian•2m ago•1 comments

Therapeutic apheresis: A promising method to remove microplastics?

https://genomicpress.kglmeridian.com/view/journals/brainmed/1/3/article-p52.xml
1•domofutu•4m ago•0 comments

Social Media Ban Moves Closer in Australia After Tech Trial

https://www.bloomberg.com/news/articles/2025-06-19/teen-social-media-ban-moves-closer-in-australia-after-tech-trial
1•gametorch•4m ago•0 comments

TikTok ban enforcement delayed another 90 days to September 17

https://appleinsider.com/articles/25/06/19/tiktok-ban-delayed-another-90-days-to-september-17
1•gametorch•5m ago•0 comments

Kadicon: A Minecraft Classic 0.30 server written in V

https://github.com/Sailing-With-Coffee/Kadicon
1•fork-bomber•8m ago•0 comments

Ask HN: How are you following tech blogs?

1•dnnsthnnr•12m ago•1 comments

Show HN: Mailfrom.dev – a cheaper MailTrap alternative (2-month update)

https://www.mailfrom.dev
1•danielebuso•12m ago•0 comments

Notes on "Andrej Karpathy: Software is changing(again)"

https://medium.com/@bingwuthu/andrej-karpathy-software-is-changing-again-notes-5d5ffe36055c
1•bingwu1995•12m ago•0 comments

Scientists discover promising new way to filter microplastics out of human body

https://www.yahoo.com/news/scientists-discover-promising-way-filter-104558970.html
1•01-_-•13m ago•0 comments

Ginkgo Biloba: Worth the Hype?

https://domofutu.substack.com/p/ginkgo-biloba-worth-the-hype
1•domofutu•15m ago•0 comments

Mississippi Online Age-Verification Law Blocked for Second Time

https://news.bloomberglaw.com/litigation/mississippi-online-age-verification-law-blocked-for-second-time
1•01-_-•16m ago•0 comments

The continuous glucose monitor is emblematic of new emphasis on self-reliance

https://www.theatlantic.com/family/archive/2025/06/continuous-glucose-monitor-maha/683224/
1•fortran77•17m ago•0 comments

'Your bones rattle': Thrill of chasing rocket launches on California coast

https://www.latimes.com/travel/story/2025-06-19/rocket-launches-vandenberg-space-force-base-lompoc-travel
1•TMWNN•18m ago•1 comments

Google, Facebook, Apple, GitHub Breached

https://decrypt.co/326163/data-breach-hits-billions-logins-google-facebook-github
2•nullndr•19m ago•2 comments

Man with the world's highest IQ declares 'Jesus Christ is God'

https://thepostmillennial.com/man-with-worlds-highest-iq-declares-jesus-christ-is-god
2•thinkingemote•28m ago•0 comments

Show HN: DIY Streaming with WebSockets and Matroska

https://mid.net.ua/posts/streaming.html
1•mids_hn•33m ago•0 comments

Show HN: Geneo – Track your brand visibility across AI search

https://geneo.app
1•yanzt•33m ago•0 comments

VPNs, naughty parents: Australia won't test teen social media ban circumvention

https://www.crikey.com.au/2025/06/20/teen-social-media-ban-trial-all-methods-vpns-parents-help/
1•pingers123•34m ago•0 comments

Show HN: Supakeep – Prevent Supabase free tier projects from getting paused

https://supakeep.xyz
2•lutfifadlan•35m ago•0 comments

Iranian missile strikes tech park housing Microsoft office in southern Israel

https://www.cnn.com/2025/06/20/world/video/israel-iran-missile-strike-tech-park-microsoft-digvid
4•t0lo•37m ago•0 comments

Texas lawmakers urging Tesla to delay Robotaxi rollout [video]

https://www.youtube.com/watch?v=vm3qLtxh-xg
2•hank808•38m ago•0 comments

Sony Just Announced Their Streaming Service, It's Called Netflix (2021)

https://mgs.blog/sony-just-announced-their-streaming-service-its-called-netflix-79ea5b917aae
1•Bluestein•38m ago•0 comments

Ask HN: What Agent should I build next? Looking for ideas

1•Arindam1729•44m ago•0 comments

Why Developers Fear Memory Leaks? and How Can Beat Them Easily

https://middleware.io/blog/memory-leaks/
1•NeelShah2409•45m ago•1 comments

Building a XIAO RP2040 Based Malicious USB Hacking Device for Only $5 [video]

https://www.youtube.com/watch?v=MMwDBquDESE
1•meilily•47m ago•0 comments

November 2026 Human-Made Object Will Reach a Light-Day from Earth for First Time

https://www.iflscience.com/in-november-2026-a-human-made-object-will-reach-a-light-day-from-earth-for-first-time-in-history-79691
1•Bluestein•50m ago•0 comments

Rise in alert fatigue risks phone users disabling news notifications study finds

https://www.theguardian.com/media/2025/jun/20/increase-alert-fatigue-phone-users-disable-news-notifications-study-finds
1•beardyw•52m ago•0 comments

Google looks likely to lose appeal against record $4.7B EU fine

https://www.cnbc.com/2025/06/19/google-looks-likely-to-lose-appeal-against-record-4point7-billion-eu-fine.html
6•doener•53m ago•0 comments

Rose-Gold-Tinted Liquid Glasses

https://lmnt.me/blog/rose-gold-tinted-liquid-glasses.html
2•mpweiher•59m ago•0 comments