by im-poor · 5y ago · 0 comments
If someone is doing it right, any point in their "mid way" that they expose will be git bisectable. Otherwise, they're doing it wrong. Squashing 20 already decent git bisectable commits into 1 big one is the complaint here.
Squashing 20 shit commits into a giant ball of shit that happens to compile and run is not better though.
Don't make the 20 shit commits in the first place.
If it turns out that we don't want to use the new method without some modifications, then the commit that adds calls to that method could be reverted insured of having to revert the entire implementation.
My feature branches are full of useless commits (from the perspective of the main branch), and anyone that tells me to clean that up prior to a merge can pound dirt. Of course, my repos use squash merge, so I'd never get that complaint.
Do what you like in your own branch. Nobody cares.
In the case of a high quality maintained project, such as the Linux kernel, it's when you propose to merge something that it gets policed. The reviewers and maintainers won't let in any PR that doesn't meet quality standards; for large PRs that means a sequence of high quality commits.
> Of course, my repos use squash merge, so I'd never get that complaint.
If you're saying you squash merge into your own repo prior to submitting the merged result as a PR to a repo maintained by others, that works. That _is_ a form of cleaning up prior to upstream merge. As long as it passes review upstream that's fine, even with the Linux kernel.
If you are squash merging into your own repo and there's no upstream, you're obviously free to run your project however you like.
Squash merges make sense when the merged PR is full of junk that should be deleted, as you described.
But in that case, if you have reviewers in the loop, I would argue you are proposing junk for them to review which you will delete afterwards, and that encourages lower quality, more superficial reviews. Why not just squash it down before the pre-merge review instead, if that's what you're proposing to merge anyway?
In a high quality, heavily reviewed project like Linux kernel, a PR has carefully curated commits to assist the review, show each step makes sense, and allow cherry-picking, bisecting and reversion later. That's more useful to the project. It'd be a waste to throw that knowledge away with a squash merge as soon as the reviewers have gone through it.
That's typically handled when the code is reviewed.
> My feature branches are full of useless commits (from the perspective of the main branch), and anyone that tells me to clean that up prior to a merge can pound dirt.
If I were reviewing it, then you would not get my approval until the commit history is cleaned up. It would be the same result if your code was failing a test scenario, not making it past the linter, or if someone asked you to clarify what's being done by adding a comment block.