| ▲ | rectang 4 days ago | ||||||||||||||||||||||||||||||||||||||||||||||
Crafting a PR as an easily-consumed, logical sequence of commits is particularly useful in open source. 1. It makes review much easier, which is both important because core maintainer effort is the most precious resource in open source, and because it increases the likelihood that your PR will be accepted. 2. It makes it easier for people to use the history for analysis, which is especially important when you may not be able to speak directly to the original author. These reasons also apply in commercial environments of course, but to a lesser extent. For me, organizing my PRs this way is second nature and only nominal effort, because I'm extremely comfortable with Git, including the following idiom which serves as a more powerful form of `git commit --amend`:
An additional benefit is that this methodology doesn't work well for huge changesets, so it discourages the anti-pattern of long-lived topic branches. :)> For that matter, why merge? Rebase it on top. Yes, that works for me although it might not work for people who aren't going to the same lengths to craft a logical history. I have no interest in preserving my original WIP commits — my goal is to create something that is easy to review. BUT... the PR should ultimately be merged with a merge commit. Then when you have a bug you can run `git bisect` on merges only, which is good enough. | |||||||||||||||||||||||||||||||||||||||||||||||
| ▲ | Izkata 4 days ago | parent | next [-] | ||||||||||||||||||||||||||||||||||||||||||||||
> 2. It makes it easier for people to use the history for analysis, which is especially important when you may not be able to speak directly to the original author. I've been on a maintenance team for ~5 years and this has saved me so many times in svn, where you can't squash, for weird edge cases caused by a change a decade or more ago. It's the reason I'm against blind squashes in git. My favorite was, around 2022, discovering something that everyone believed was released in 2015, but was temporarily reverted in 2016 while dealing with another bug, that the original team forgot to re-release. If the 2016 reversion had been squashed along with the other bug, I might never have learned it was intended to be temporary. I'm fine with manually squashing "typo" commits, but these individual ones are the kind where you can't know ahead of time if they'll be useful. It's better to keep them, and use "git log --first-parent" if you only want the overview of merges. | |||||||||||||||||||||||||||||||||||||||||||||||
| |||||||||||||||||||||||||||||||||||||||||||||||
| ▲ | vjerancrnjak 4 days ago | parent | prev | next [-] | ||||||||||||||||||||||||||||||||||||||||||||||
I have an exactly opposite preference. Give me a big change to review. Going commit by commit or any imposed steps is not how I write code or how I understand code. If you did not approach it through literate programming, I just prefer all of the thousands of lines at once. | |||||||||||||||||||||||||||||||||||||||||||||||
| |||||||||||||||||||||||||||||||||||||||||||||||
| ▲ | hinkley 4 days ago | parent | prev [-] | ||||||||||||||||||||||||||||||||||||||||||||||
Also for a year from now when I’m wondering wtf I was thinking when I put that bug into the code. Was a thinking of a different corner case? Or not at all? | |||||||||||||||||||||||||||||||||||||||||||||||