two different versions of a codebase, one heavily commented and one with zero (or minimal) comments
If you have 开发者_高级运维a project where the only difference in the 2 branches are the comments, what is a good workflow (assuming Git, but other ideas are welcome):
- simply write a hook that strips out comments after each commit and saves the result to a set of files, use only a single branch
- simply maintain 2 branches
- other
It depends why you need the branch with no comments. If it is only to release to someone (or something) periodically, then I would go with the hook-script approach.
I can't see why you would have anyone working on the uncommented version if comments are available. Stripping them in a script on-demand therefore seems preferable to maintaining a branch with comments stripped (which would no doubt cause headaches on integration).
If one version has no comments, then by all means - it would be best to strip them automatically (but at the retrieval stage, not the commit). Otherwise, either merge them or keep two branches.
精彩评论