3

I don’t like commented code in a project, I always remove commented code whenever I see. But sometimes these removed commented codes need again to add by uncommenting.

I can get the code by seeing the git history but if only I can remember I removed that portion of code. So is there is any best approach to manage commented code, which may require in real future?

Comments
  • 1
    Check the file history always... just in case, you know...

    PS: if you are on windows, git extensions is a pretty great one for quickly doing that
  • 2
    If it's got some explanatory text like "Keeping this here because blah blah blah", just leave it. It's not hurting anything and could end up helping those who look at the file with a little extra context.
  • 1
    One of the ways I use snippet is saving chunk of codes that is useful or that might be useful. Gitlab, GitHub, bitbucket all provide snippet functions.
Add Comment