{"by":"edverma2","descendants":51,"id":44324457,"kids":[44325523,44324929,44325424,44327761,44324941,44324764,44325577,44334536,44325054,44324978,44325200,44328892,44324753,44325364,44325153,44324768,44327104,44325839,44326087,44325806],"score":76,"text":"I&#x27;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.<p>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&#x27;s suggestion. Then you can force push your branch to your remote to make it match.<p>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&#x2F;org will need to be ok with. As long as you are working on a feature branch this is usually fine, but it&#x27;s always worth checking if you are not sure.","time":1750389779,"title":"Show HN: Tool to Automatically Create Organized Commits for PRs","type":"story","url":"https://github.com/edverma/git-smart-squash"}