What should NOT be under source control?

前端 未结 24 2387
野的像风
野的像风 2020-12-04 07:24

It would be nice to have a more or less complete list over what files and/or directories that shouldn\'t (in most cases) be under source control. What do you think should be

24条回答
  •  甜味超标
    2020-12-04 08:02

    Like Corey D has said anything that is generated, specifically anything that is generated by the build process and development environment are good candidates. For instance:

    • Binaries and installers
    • Bytecode and archives
    • Documents generated from XML and code
    • Code generated by templates and code generators
    • IDE settings files
    • Backup files generated by your IDE or editor

    Some exceptions to the above could be:

    • Images and video
    • Third party libraries
    • Team specific IDE settings files

    Take third party libraries, if you need to ship or your build depends on a third party library it wouldn't be unreasonable to put it under source control, especially if you don't have the source. Also consider some source control systems aren't very efficient at storing binary blobs and you probably will not be able to take advantage of the systems diff tools for those files.

    Paul also makes a great comment about generated files and you should check out his answer:

    Basically, if you can't reasonably expect a developer to have the exact version of the exact tool they need, there is a case for putting the generated files in version control.

    With all that being said ultimately you'll need to consider what you put under source control on a case by case basis. Defining a hard list of what and what not to put under it will only work for some and only probably for so long. And of course the more files you add to source control the longer it will take to update your working copy.

提交回复
热议问题