对您想要获取一次但不想在第一次获取后提交更改的文件进行版本控制的最佳方法是什么
我在工作项目和个人项目中使用 Subversion 和 TortoiseSVN。
我想知道在能够设置存储库方面什么被认为是最佳实践,以便执行 SVN Checkout 和 VisualSVN for Visual Studio 将为您提供编译所需的所有内容 ... 但我希望能够标记某些文件,以便它们不会被推荐用于任何 SVN 提交。 理想情况下,该文件甚至不再被标记为已更改(我就是这样)。
典型的例子是 app.config,每个开发人员机器都有不同的连接字符串。
赛斯
I use subversion with TortoiseSVN on projects at work and my personal ones.
I was wondering what is considered best practice in terms of being able to setup your repo so that doing a SVN Checkout and VisualSVN for Visual Studio will get you all that you need to compile
...
but I want to be able to mark certain files so that they will not be recommended for any SVN Commits. Ideally the file would no longer even be marked as changed (I'm anal like that).
The classic example of this would be an app.config that will have different connect strings for each developer machines.
Seth
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(5)
通常的方法是创建一个模板文件并提交,然后将配置文件添加到 svn:ignore。 您甚至可以更进一步,在 Visual Studio 中添加预编译步骤来检查配置文件,如果不存在,则从模板创建它。 根据配置中要设置的值,这可能是也可能不是一个好主意。
The usual approach is to create a template file and commit that, then add the configuration file to svn:ignore. You could even go a step further and add a pre-compile step in Visual Studio that checks for the configuration file and, if not present, creates it from the template. Depending on the values to be set in the configuration this might or might not be a good idea.
我通常提交一个 web.config.template 并让其他开发人员将其复制到 web.config 并进行他们想要的任何更改。 然后,他们可以选择 web.config 和 web.config.template 文件,并使用 Tortoise(或任何其他类似功能)显示两个文件之间的差异。 这将显示他们的本地更改,以及对模板所做的任何更改。
I usually commit a web.config.template and let the other developers copy this to web.config and do any changes they want. They can then select both their web.config and the web.config.template file and, using Tortoise (or any other similar functionality) show differences between the two files. This would show their local changes, and also any changes done to the template.
使用本地 svn:ignore
http://sdesmedt .wordpress.com/2006/12/10/how-to-make-subversion-ignore-files-and-folders/
Use a local svn:ignore
http://sdesmedt.wordpress.com/2006/12/10/how-to-make-subversion-ignore-files-and-folders/
在存储库中共享 app.config.example 并 svn:ignore 想要为自己保留的文件怎么样?
What about having a app.config.example shared in the repository and svn:ignore the files you want to keep for yourself ?
如果您使用的是 Visual Studio,大多数(但不是全部)项目系统都支持“从源代码管理中排除”操作。 不幸的是,您不会在上下文菜单中找到它。 必须在解决方案资源管理器中选择文件,然后选择文件 -> 源代码控制 -> 排除。 从那时起,项目/解决方案将不会在编辑/保存等时向活动源代码控制提供程序发出任何请求(取决于您的工具 -> 选项 -> SCC -> 环境设置)。
当然,如果您离开 VS 并意外地从 Tortoise 中签出/签入排除的文件,这将不起作用。
If you're using Visual Studio, most (but not all) project systems support the "Exclude From Source Control" action. You won't find it on the context menu unfortunately. Have to select the file(s) in Solution Explorer, then File -> Source Control -> Exclude. From then on, the project/solution will not make any requests to the active source control provider upon editing/saving/etc (depending on your Tools -> Options -> SCC -> Environment settings).
Naturally this won't work if you leave VS and accidentally checkout/checkin the excluded file from Tortoise.