DEV Community

Discussion on: I'm a Git Master, Ask Me Anything

Collapse
 
ben profile image
Ben Halpern

What would you recommend to help developers become more comfortable deleting dead code (as opposed to commenting it out) with the confidence they could find it later in source control?

Collapse
 
gonedark profile image
Jason McCreary • Edited

Commented code is dead code - REMOVE IT! Let Git do its job.

But yes, I recommend doing it as a separate commit with a clear commit message on what code was deleted so you have the best chance of finding it again.

However, from my experience, it's rare you'll actually look for code this way. Most people just go back to a known point in history to see old code instead of trying to pinpoint the exact commit.