DEV Community

Discussion on: ⛔ Squash commits considered harmful ⛔

Collapse
 
manzapanza profile image
Massimo Rangoni • Edited

IMHO the main problem when you do NOT squash your work (generally it's a feature or a fix) is that, sometimes or often (it depends on how many devs are working on the same repo and how disciplined they are) you have to fix more merge/rebase conflicts.

Let's say you send a PR with 5 commits, and you have made changes on a same line in 3 of those 5 commits. And after that you have to rebase your PR (because other PRs were accepted before yours) and unluckily you got a conflict on that line... you will have to fix 3 times a merge conflict. but if you squash your work you have to fix just 1 merge conflict. So all those little code refactoring made during the development of the same feature/fix could multiply these problems exponentially.

Another aspect is that all those sub-feature/fix commits make sense just for the author, but for the other devs generally not.

But what I'm saying depends on some assumptions I've made, for example if you're working alone in a repository these issues will probably never happen.

Anyway, although I don't agree with you, I liked the article for the discussion it generated.

Thank you!