News for hackers. Stuff that matters.
Re:Nobody Cares About Your Git History by akoboldfrying on Friday January 26, 2024 @04:52AM (#39140688)
With you on detailed PRs and linked tickets.

Regarding squash-merge: If you're taking about using GitHub's "Squash and merge" button, then as soon as you do this, you lose the SHA1 connection between what you committed locally and what winds up in the GitHub repo. This can result in unnecessary confusion later, in my experience. Better to squash-merge locally before pushing IMHO.

But better yet is to not squash at all! git log has --first-parent, which gives you essentially the same tidy view as if you'd always squash-merged (or always rebased) -- but the gory detail is still there if you need it. (That's provided that you either specify -m to git merge, or have moderately descriptive branch names so that the default "Merge branch 'add-cool-feature' into main" message suffices.)

Re:Nobody Cares About Your Git History by kenmacd on Friday January 26, 2024 @08:33AM (#39142413)
I couldn't agree more. I've worked on multiple projects where PRs must be 'squash-merged' and I've never understood why people want to throw away history and make their bisects harder.

If you use proper merges you can always see a 'squash-merge' view of the repo. If you squash you can never see an individual commit view.

Also if you're required to tie changes to some ticket system—especially if you have to put that ticket info in the subject—then with merges you can put that ticket info just in the merge commit and the rest of the commits can have proper subjects with actual useful information in them.