|
|
|
|
|
by mkiwala
3349 days ago
|
|
I don't think I will ever understand people's fascination with squashing feature branches. Develop on a branch, yes; rebase the branch instead of merging in master, sure. But why delete the history by squashing, when a merge into the mainline can look just as neat without requiring history to be deleted. The argument that I've heard is "so that I don't have to all of that detailed history." But that is a display problem, not an argument for removing history. |
|
The reason I like doing squashes is not because I don't want a detailed history. It's because (1) it allows me to commit often, even when the code isn't fully finished, might not build or pass all the tests and (2) during code review, I might need to fix a typo, change the code, or make other changes. By squashing these commits into one feature commit, I can ensure that each commit builds and passes tests, which is very helpful when doing git bisects later. It also removes history that doesn't matter (those code review fixup commits, as well as all my work-in-progress commits), so what's left is a nice history of the project, hopefully with each commit describing in high-level detail what changed and why, as well as linking to a ticket/issue/bug report.
That also lets me only use merge commits for things that really are "merging", such as merging develop into master, where master has additional hotfix commits. I always use merge commits for that (never fast-forwarding), so it's always clear when code was merged from develop and released.