2 ms·
Rebase and squash makes your bisects worse for no real benefit. OP is wrong about commit messages ("fixp" is fine, most of the time you're not going to read th
by lmm 3y ago
Rebase and squash makes your bisects worse for no real benefit.
OP is wrong about commit messages ("fixp" is fine, most of the time you're not going to read the commit message) but right about everything else on the git side.
- juped 3y agoof course no one reads your commit messages if they're useless!
- lmm 3y agoI've worked at places that enforced "good" commit messages. They didn't get read any more, they just meant people committed less often and so commits were less atomic (e.g. people wouldn't bother splitting formatting changes out into a separate commit because they'd have to write another commit message) and bisect was less useful.
- ajkjk 3y agoGood commit messages are about 1s more work than bad ones. They don't have to be long, they just have to say something concrete and useful and instill confidence in the change. If anything, after doing a complicated arduous change writing a nice simple message to summarize it is really cathartic and destressing (for me at least). But realistically the point of good commit messages is similar to the point of code formatting standards, which is to prevent the https://en.wikipedia.org/wiki/Broken_windows_theory https://en.wikipedia.org/wiki/Broken_windows_theory on your codebase. If everything you do is held to a high standard, you'll hold everything you do to a high standard. If the organization stops doing that quality stays the same for a while but eventually slips and slips and slips. It is important to always enforce slightly more quality than you have now to keep the momentum in the other direction.
- lmm 3y ago> If anything, after doing a complicated arduous change writing a nice simple message to summarize it is really cathartic and destressing (for me at least). Sure. But the point is to get away from doing those "complicated arduous change"s, and split them up into much smaller pieces. Being able to commit without breaking your flow helps a lot with that. > But realistically the point of good commit messages is similar to the point of code formatting standards, which is to prevent the https://en.wikipedia.org/wiki/Broken_windows_theory https://en.wikipedia.org/wiki/Broken_windows_theory on your codebase. If everything you do is held to a high standard, you'll hold everything you do to a high standard. If the organization stops doing that quality stays the same for a while but eventually slips and slips and slips. It is important to always enforce slightly more quality than you have now to keep the momentum in the other direction. This is a purely circular argument. "It's important to have high quality commit messages so that you will have high quality commit messages". It really isn't.
- phailhaus 3y agoThe massive, massive benefit is that every commit on main is guaranteed to pass CI and represent an atomic set of changes that can safely be reverted. When something Goes Wrong, you want a simple `git revert` to fix everything, not go hunting for which commits correspond to which PR. It also means that when you git bisect, you know exactly which PR introduced the issue. The exact commit that did so isn't as important, because there's no way to ensure that it's safely revertible.
- lmm 3y ago> every commit on main ... can safely be reverted. Hardly. You know that master-before-that-commit passed CI, sure, but you don't know that reverting it isn't going to interact badly with subsequent changes or subsequent stored data. > It also means that when you git bisect, you know exactly which PR introduced the issue. Finding the PR from the commit is a one-liner. Github will even show you right there on the commit's page. > The exact commit that did so isn't as important, because there's no way to ensure that it's safely revertible. In my experience reverting a single small commit is a lot safer than reverting a full PR that may have e.g. added a value to an enum that's stored in the database, and when you have a culture of small, atomic, well-separated commits then each commit is likely to pass tests etc.. Also if the commit is a few lines then you're much more likely to understand why the breakage happened, rather than blindly reverting a big PR because your test passes before but not after, which is good for safety. Of course you need to test the revert but you always need to test the revert.
- phailhaus 3y ago> when you have a culture of small, atomic, well-separated commits then each commit is likely to pass tests etc. This is why it falls apart: culture is really hard to scale. If you don't have mechanisms in place to enforce this behavior, then people are going to drift. This is extra true for commit behavior, because it doesn't matter how a PR is broken down into commits; CI doesn't run on every commit. So when things Go Wrong, it is very unlikely that the buggy commit had CI run on it and the commit before, so it's probably not atomic. But the PR always is! PR's pass CI, and the main branch does too. Sure, not every PR is safe to trivially revert, but reverting a PR will always put the codebase in a known previously good state that passed CI.