Question

Is it possible to automatically remove code comments in Visual Studio files before committing to source control, or is it possible to virtually have comments in files but physically store those in separate files?

The end goal is not to have comments in source control, but be able to have those locally.

Was it helpful?

Solution

This is wrong-headed.

What you should remove is commented out code. Let the version control system do its job. Comments that illustrate what's in the code and why should remain.

How do you expect to retain them if you remove them in source control? The next time you check out the code, the comments won't be there.

OTHER TIPS

For development, It is good to keep comments in your code. Don't remove them. You cannot let your comments locally and commit non-commented files, because when checking out your repository, it'll have no comments at all.

Through comments, other developers are able to figure out what's going on much faster and be more precise as well. They can find bugs and improve your code. So, comments are cool. I mean, good comments. I know code must speaks by itself, but comments are important as well.

If you intend to save storage, please, don't do that for development process. What you can do is deploy your code withou any comment, and, if possible, compressed.

We are being programming language agnosic, but I am pretty sure every language has some way to strip out comments and optimize it for deploy.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top