| ▲ | paxys 3 hours ago |
| I don't get all the effort people spend in perfectly curating git history. No one is ever going back and reading individual commits. Just squash everything before merging and call it a day. |
|
| ▲ | jxf 2 hours ago | parent | next [-] |
| > No one is ever going back and reading individual commits. I violently disagree with this. At a minimum, when I review PRs I look at the commit history to understand what's up. If the path that was taken to commit this is full of "oops" and "fix" messages, it's an immediate reject for me. The commits tell the story and it's a kindness to your human reviewers to not make them work harder to understand the point you're trying to get across. |
| |
| ▲ | GrandfatherTECH 2 hours ago | parent | next [-] | | What's up with the fix commits? Maybe I misunderstood you, but there ain't nothing wrong in fixing stuff you offer in your PR. And there can also be multiple commits even before the PR while you're developing your PR. | | |
| ▲ | locknitpicker an hour ago | parent [-] | | > What's up with the fix commits? They shouldn't show up in the commit history. In a PR, you merge them in the commit that they actually fix. Otherwise when you use git blame to get the context of why a line of code was changed, all you see is a useless "fixup" message that is worse than having nothing. Anyone can do better than a fixup commit. And doing metter means merging them into the actual commits that are fixed. |
| |
| ▲ | nl 2 hours ago | parent | prev | next [-] | | > If the path that was taken to commit this is full of "oops" and "fix" messages great way to encourage people to rebase then! | |
| ▲ | fcarraldo 2 hours ago | parent | prev | next [-] | | Mine aren’t full of “oops” and “fix” messages, because I squashed them. | |
| ▲ | JohnMakin an hour ago | parent | prev | next [-] | | yea I look at commits several times a week at least, especially when commits are tied to a ticketing system/project it helps a lot going back months later on a large codebase going “how/why did this change happen” I do tend to squash or make my entire change in one commit though so maybe I misunderstood your comment. If I have a fix commit often I’ll just tag a separate PR/ticket to keep the change history/change control clean | |
| ▲ | InvertedRhodium 2 hours ago | parent | prev | next [-] | | Depends what the git history is supposed to show. Personally, I prefer people to leave their mistakes and reversions - though I'd require more description messages than "oops" or "fix", something that explained why it was being reverted or swapped out would be the minimum. Sometimes you try things one way and they don't work out, so you go in a different direction. Capturing why this happened and when can go a long way towards explaining downstream decisions that might seem confusing to someone with a fresh perspective. | |
| ▲ | gofreddygo an hour ago | parent | prev | next [-] | | Oh that is such a bad heuristic ! The commits and history of how a PR was put together is no indicator of the quality of the PR or the thought process that led to it. Thats the equivalent of rejecting a (handwritten) essay for having too many corrections. ridiculous. The code is all that should matter. Maybe comments for being nice to others and my future self. thats it. | | |
| ▲ | locknitpicker an hour ago | parent [-] | | > The commits and history of how a PR was put together is no indicator of the quality of the PR or the thought process that led to it. It is, because it means the person posting the PR didn't even bothered to review the changes they are forcing others to review. Just clean after yourself before asking others to read your stuff. |
| |
| ▲ | bobbylarrybobby 2 hours ago | parent | prev | next [-] | | Do you really care if someone forgot to format before committing? They can always squash and push locally if they need to. | | |
| ▲ | locknitpicker an hour ago | parent [-] | | > Do you really care if someone forgot to format before committing? Not OP but yes I definitely do. If you expect others to spend time reviewing your code, you are obligated to start off by reviewing it yourself. Posting a mess helps no one and makes code harder to audit. |
| |
| ▲ | danieltanfh95 2 hours ago | parent | prev [-] | | NGL AI usage is driven by friction in presentation and communication over petty details. |
|
|
| ▲ | jhealy 2 hours ago | parent | prev | next [-] |
| > No one is ever going back and reading individual commits I do, regularly! In a repository where care has been taken, it can be super valuable when tracking down a bug or regression, and understanding the intent of the author |
|
| ▲ | nextlevelwizard 12 minutes ago | parent | prev | next [-] |
| How do I know you don’t work in a big team from this? First thing I do every time I come back from vacation is to read through our git history to see what has happened. It is also very useful when CI breaks. In fact I probably use some form of git history reading every day at work. Also if your code base is so tiny and the features you work on are so small that you can just squash everything then maybe that is fine for you. I definitely love being able to actually see what is going on and selectively cherry picking or reverting commits |
|
| ▲ | jolmg 2 hours ago | parent | prev | next [-] |
| > No one is ever going back and reading individual commits. Straight from the git-log, maybe not, but sometimes you see code that makes you wonder how it came to be and it can help a lot to see it in context of the commit that introduced it. That'd be less helpful if that commit were some huge thing making lots of different changes at once. |
| |
| ▲ | paxys 2 hours ago | parent [-] | | Seeing the individual change in the context of the larger feature is actually more helpful. Otherwise you find a tiny commit that changes A to B and then have to chase down 13 other commits around it to figure out why that change was even made. | | |
| ▲ | jolmg 2 hours ago | parent [-] | | Yeah, there's a balance. I try to make my commits so they make sense on their own. > commits around it to figure out why that change was even made. A commit should be such that the message can articulate the why. |
|
|
|
| ▲ | broodbucket 2 hours ago | parent | prev | next [-] |
| Having a well curated one-logical-change-per-commit history is incredibly valuable when bisecting a regression. |
| |
| ▲ | efilife 2 hours ago | parent [-] | | Didn't you mean "dissecting"? Edit: thanks guys, that's very useful knowledge! Could have saved me many times in the past | | |
|
|
| ▲ | msteffen an hour ago | parent | prev | next [-] |
| One use-case for curating commits other than git history is carefully structuring code reviews to be easy to review. Eg "commit 1 just rearranges existing code, no business logic changes"..."change 2 modifies business logic, but in one localized place as the refactoring has already been done"..."change 3 only modifies comments" |
|
| ▲ | Myrmornis 2 hours ago | parent | prev | next [-] |
| One good reason is to keep your tests separate from the fixes that make your tests pass. That way you can check your test fails before the next commit makes it pass, eliminating the risk of a false negative (test passes that would have anyway). |
| |
| ▲ | assbuttbuttass 2 hours ago | parent [-] | | That sounds like it would break bisect | | |
| ▲ | bonzini 18 minutes ago | parent | next [-] | | You can develop with failing tests and reorder them after the code change before publishing your branch. | |
| ▲ | Myrmornis 2 hours ago | parent | prev | next [-] | | Fair. I think what I'd say is that we don't have to use plain git bisect -- it would be quick to make a bisect script that doesn't land on the failing-test commits. Especially seeing as most teams squash before merging, we should have the freedom to create failing-test commits. | |
| ▲ | jolmg 2 hours ago | parent | prev | next [-] | | Right, maybe a better way to get what they're going for would be git checkout @~ ^tests
where ^tests is zsh's way of saying * except for tests. So you get the tests/ of the current commit and the code of the prior. | |
| ▲ | locknitpicker an hour ago | parent | prev [-] | | > That sounds like it would break bisect Nonsense. First off, you can pick the starting commit, and nothing forces you to pick the test one. Second, bisect is designed to tracks changes from good state to bad state based on your personal criteria of what good and bad is. This means that you are free to put up tests that make sense to you (i.e., all tests except the one that was added as a red test) and even not run a test at all. |
|
|
|
| ▲ | Izkata an hour ago | parent | prev | next [-] |
| I do multiple times a week, with repos that have barely been touched in a decade and all the original devs are gone. Squashing would make figuring out why something is the way it is a lot more painful, so I'm glad these repos are svn where squashing wasn't an option. Several times I've discovered bugs that were introduced in linting commits that would have been squashed, so the fix ends up trivial since the intention is already there in the previous commit. |
|
| ▲ | seba_dos1 2 hours ago | parent | prev | next [-] |
| Of course we do and it helps tremendously when the graph is reasonable. |
|
| ▲ | smcameron 36 minutes ago | parent | prev | next [-] |
| Disagree. You need small, git bisectable commits. Use stgit to do it and it's nearly effortless. |
|
| ▲ | vcf 2 hours ago | parent | prev | next [-] |
| I almost never went back to read the history, but now I often have Claude go through the history when I wonder how we got to a certain point. It can point me to the relevant issues as well. Squashing is fine, up to a point. |
|
| ▲ | EPWN3D 2 hours ago | parent | prev | next [-] |
| Sorry, no. Just because you've never done it doesn't mean that no one ever will. Beyond the archival benefits, I've found plenty of bugs by going back through my "wip" commits and creating a sane history from them. |
|
| ▲ | sitkack an hour ago | parent | prev | next [-] |
| That is like saying once the program is done, throw away the source. Lemme guess all your for commit say "wip" |
| |
| ▲ | yjftsjthsd-h an hour ago | parent [-] | | It's really not. Source code, even with no history, can be modified, adapted, ported, fixed, and improved. Having history is nice, but it's way lower marginal utility. |
|
|
| ▲ | locknitpicker an hour ago | parent | prev | next [-] |
| > No one is ever going back and reading individual commits. Your assumption doesn't match the real world practices I've experienced for years across multiple jobs. Even at the PR stage a clean commit history is of critical importance. Nowadays, with ai coding assistants assuming a central role in developing software, commit history is even used as input with context signal, allowing for flows such as "evaluate the changes in commit X and Y and apply the same pattern to project Z". Just because you don't use a tool properly that doesn't mean everyone around you makes the same mistake. |
|
| ▲ | ex1fm3ta 2 hours ago | parent | prev [-] |
| I do not agree at all. When you have multiple repos accross different services, commits are the best way to follow up with differents changes. We adopted conventional commits guidelines a few months ago and everyone is happy. Even ClaudeCode is able to keep up and auto fix stuffs with the proper commit messages. The changelog is dynamically updated. Everything so smooth when those commits messages are perfectly synchronized. |