3 ms·
The thing is that "you can always find it back with Git" only holds when you're pretty proficient with Git (or know where to click in a UI like SourceTree, and
by skrebbel 11y ago
The thing is that "you can always find it back with Git" only holds when you're pretty proficient with Git (or know where to click in a UI like SourceTree, and even that takes a while to figure out). Many people basically don't get much further than commit, push, pull. For them, deleting means they need to go and ask someone like you for help to get things back. Commenting keeps them in control.
A rule that I like that is 100% enforceable: commented code is allowed, but there needs to be a comment above the code explaining why the code was commented. The effect in practice of this rule is that
- People delete code more and comment it less
- Readers know whether to need to pay attention to the commented code or not.
Point 1 happens the most. I begin to write down something like "keeping this code around because I'm not sure yet whether the new code is better" and then I backspace and delete the whole thing because I realise it clearly is.
- riffraff 11y agoto be fair, I think commenting code in a sense "works better" then "git revert" because you don't need to solve conflicts, you just keep writing code around the commented one. I rationally know that I can remove and re-add it later and that commit/revert is better, but the pain associated with solving conflicts is strong enough that I subconsciously want to avoid it.