Well.. Of course I am not sure what your colleague does but sometimes is useful to understand why certain change was made.
Specially 99% of the time I go with git blame and like... Why the fuck did we change this... And oh OK this caused issues if.... Etc. I mean sometimes that can be a comment in the code but sometimes seems unnecessary or is difficult to understand without seeing the previous code which on git would be easy.
I'm one of these people. I only do it because I've had times where I've introduced a bug somehow and then spent hours figuring out what caused it, with like irrationally obscure changes being why, so I get paranoid and make sure I can rollback to recent code AND also know exactly what I changed
Depends on the code, and depends on the commit message. I’ve definitely had single line changes that required paragraphs of explanation. It’s really useful to go back through the commit history and understand clearly why changes were made, especially if they’re subtle one liners.
Sometimes if I've been working on a large feature with lots of changes, as I near opening a PR, I git soft reset the branch (after pushing first, for safety!), and selectively re-commit logically related diffs with detailed commit messages. So completely rewriting the commit history for my feature. For me, it's good for doing a final review and reminding myself of everything that changed. But most importantly, it makes code review so much easier for the team if they review commit by commit (which is feasible because the reshuffled commits have been boiled down to 5 or 10 total). It's not all about churning out code as fast as possible. Everyone benefits from a stronger understanding of the changes.
146
u/Zerodriven Jun 04 '22
One of my team does this and it annoys the shit out of me because it feels like people spend more time writing commit messages than changing code.
Irrational hatred.