If you use Pull Requests with squashed commits, you can do exactly the same process as described here by isolating the issue to a PR then restoring the branch and bisecting from there. It seems like a small price to pay for a clean history, given the rarity of occurrences like this.
It seems like a needless price to pay, since the whole point of keeping history is to help analyze problems and past states. The author has only used bisect for a head-scratcher once, but I've used it often, sometimes to pin down bugs in code I'd never even looked at before. That's not feasible if the commits are huge.
Fortunately, I don't squash my commits
21–30 of 333 posts
Re: Fortunately, I don't squash my commits
#22Which can be perfectly fine, as it's hard to ensure that all developers use Git in an optimal way (I'm thinking of intentful use of interactive rebasing), uniformly.
The only problem I find is when squash proponents claim their choice is superior. It's not; it's only superior if you aren't willing to maintain great history as you work on a given branch.
Of course there are also added benefits to a fine-grained history, as the article mentions.
My experience having maintained a production app with a fine-grained semantic history for 5 years is overwhelmingly positive. Understanding root causes, confidently reverting things etc becomes a much quicker job - particularly important when production is red.
Re: Fortunately, I don't squash my commits
#23Do people out there actually squash commits? Granted, I didn't change many work places in my career, but at no place where I worked people squashed commits. What's even the point of it? It's not like people routinely read the commit history, and when they do, they really would like a complete story, not 20 gargantuan commits that contain 3 years of development.
If I need to bisect a bug that was introduced by the PR I still can do this in the original branch.
Re: Fortunately, I don't squash my commits
#24Do people out there actually squash commits? Granted, I didn't change many work places in my career, but at no place where I worked people squashed commits. What's even the point of it? It's not like people routinely read the commit history, and when they do, they really would like a complete story, not 20 gargantuan commits that contain 3 years of development.
With some discipline this makes the commit history actually worth reading and makes git blame a useful tool.
Re: Fortunately, I don't squash my commits
#25Straw poll - do you enforce this? If so, for literally every commit, or do you use partial squashing to maintain this property?
While that's certainly a _desirable_ property, I've never really been concerned if, say, the penultimate commit on a PR failed CI. It feels like it would be a hassle.
Re: Fortunately, I don't squash my commits
#26Do people out there actually squash commits? Granted, I didn't change many work places in my career, but at no place where I worked people squashed commits. What's even the point of it? It's not like people routinely read the commit history, and when they do, they really would like a complete story, not 20 gargantuan commits that contain 3 years of development.
So I end up with "one commit per feature" rather than "one commit per logical change". So I actively using squash during interactive rebase when I prepare to merge completed branch since my commit history sometimes looks like this:
Backend: new set of APIs for XYZ
Backend: implement feature X (+ some long comment)
Frontend: implement feature X
fix for feature backend
fix for backend API XYZ
front fix
backend fix
Yeah again I know I could do better, but yeah I use squashing for this reason. A lot.Re: Fortunately, I don't squash my commits
#27Do people out there actually squash commits? Granted, I didn't change many work places in my career, but at no place where I worked people squashed commits. What's even the point of it? It's not like people routinely read the commit history, and when they do, they really would like a complete story, not 20 gargantuan commits that contain 3 years of development.
I'm sort of agnostic on this issue, but I do feel the article's author kind of overstated it here. Say 5 to 10 commits of this size were squashed together. Git bisect would've taken him 90+% as far and he'd have to read code or manually trial and error changes just slightly more. The binary searchable problem space would be slightly smaller, and the linear manual effort space slightly bigger. Less good, but really not that big of a deal.
Re: Fortunately, I don't squash my commits
#28Earlier quoted context omitted.
It seems like a needless price to pay, since the whole point of keeping history is to help analyze problems and past states. The author has only used bisect for a head-scratcher once, but I've used it often, sometimes to pin down bugs in code I'd never even looked at before. That's not feasible if the commits are huge.
You do keep the history in the branch, it's just out of the way unless you really need it. Also, the method I described has nothing to do with commits. PRs and small commits aren't mutually exclusive.
That was the price I was thinking of.
You're certainly right that PRs and large commits are orthogonal.
Re: Fortunately, I don't squash my commits
#29I never understood the need to squash commits (or rebase). If you do merge requests and use merge commits (like GitHub or gitlab do). A "nice" history is a small script away. It should even be a part of the GitHub/gitlab gui. Do not loose information about the development history!
Merge commits are noise, a clean history is has no merge commits
Re: Fortunately, I don't squash my commits
#30If you use Pull Requests with squashed commits, you can do exactly the same process as described here by isolating the issue to a PR then restoring the branch and bisecting from there. It seems like a small price to pay for a clean history, given the rarity of occurrences like this.