I hear this sentiment a lot, and I at least understand the sort of purity of deleting code instead of commenting it out, but that's the only value it seems to bring whenever I try it.
Scrubbing back into history (or remembering that there's even something to scrub back to) doesn't seem to ever be as convenient for me as it is for people that are peeved by commented out code.
I'm not that great at Git, but I'm also not trawling through history very frequently and there still seems to be a mental overhead associated with it compared to seeing some commented code a few lines away.
The article goes on to say:
> I wasn't sure whether we would ultimately keep the
> widget or not, so I opted to keep the above
> javascript code for the controller and view around
> for awhile so it would be easily available if I
> later decided to re-enable that UI element.
That seems reasonable to me.
In a file I was just working on before I decided to habitually check HN, I have two past versions of a function commented out above the final revision of the function. Next to each older revision, I've annotated some reasons why they were revised. When I continue to work on this function a week from now, I'm reminded of my efforts so far.
Someone would probably say that those annotations should be moved into commit messages and the git log should tell the story about this function.
But all that really seems to do is disperse my notes about this function across intermittent entries into this file's commit history. And once those past revisions are deleted from the current view of the file, I certainly won't remember that those notes exist for me to scrub back to in the first place.
- How do you manage this kind of stuff?
- What's your workflow for looking for and fetching deleted code?