logoalt Hacker News

sallveburrpilast Tuesday at 9:00 PM4 repliesview on HN

squash results in a cleaner commit history. at least that’s why we mandate it at my work. not everyone feels the same about it I guess


Replies

Denvercoder9last Tuesday at 9:07 PM

Squashing only results in a cleaner commit history if you're making a mess of the history on your branches. If you're structuring the commit history on your branches logically, squashing just throws information away.

show 6 replies
Faaaklast Tuesday at 9:08 PM

What about separate, atomic, commits? Are they squashed too? Makes reverting a fix harder without impacting the rest, no?

show 1 reply
awesome_dudelast Tuesday at 11:01 PM

Squash loses the commit history - all you end up with is merge merge merge

It's harder to debug as well (this 3000line commit has a change causing the bug... best of luck finding it AND why it was changed that way in the first place.

I, myself, prefer that people tidy up their branches such that their commits are clear on intent, and then rebase into main, with a merge commit at the tip (meaning that you can see the commits AND where the PR began/ended.

git bisect is a tonne easier when you have that

UltraSanelast Tuesday at 10:17 PM

"squash results in a cleaner commit history" Isn't the commit history supposed to be the history of actual commits? I have never understood why people put so much effort into falsifying git commit histories.

show 3 replies