svn / subversion:在新签出时获取所有文件,但随后从更新/签入中排除某些文件
重新结帐后,我想获取所有文件, 特别是这个文件:etc/config.ini
但是,一旦我修改了etc/config.ini,我不希望它用“svn commit ...”提交,也不应该在“svn up”上恢复。
这将允许您在初始签出时获得默认值(约定优于配置),但是在配置之后,您不希望将这些“本地”配置文件提交到 svn 中。
After a fresh checkout, I want to get ALL files,
specifically this file: etc/config.ini
However, once I modify etc/config.ini, I do not want it committed with "svn commit ..." nor should it be reverted on a "svn up".
This would allow you to get default values on an initial checkout (convention over configuration), but then after configuring, you don't want these "local" configuration files committed into svn.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(3)
做到这一点的最佳方法是不要直接对文件进行版本控制。
避免此问题的常见方法是将
config.ini.sample
(或类似的内容)置于版本控制之下,然后在中忽略
属性。config.ini
>svn:ignore然后,签出后,将
config.ini.sample
复制到config.ini
即可。 这样您还可以对模板配置文件进行版本控制。The best way to do this is not to directly version control the file.
A common way to avoid this issue is to have
config.ini.sample
(or something along those lines) under version control, and thenconfig.ini
ignored in yoursvn:ignore
property.Then, after checking out, copy
config.ini.sample
toconfig.ini
and you're good to go. This way you can also version control your template config file.如果您使用 TortoiseSVN 和/或 VisualSVN (>= 1.5),您可以将这些文件移动到 更改列表“忽略提交”。 这会导致文件显示在提交对话框的单独部分中,并且永远不会自动选择进行提交。
显然这是一个 TortoiseSVN 特定的解决方案。
If you use TortoiseSVN and/or VisualSVN (>= 1.5), you can move these files to the changelist 'ignore-on-commit'. This causes the files to show up in a separate section in the commit dialog, and never automatically selected for committing.
Obviously this is a TortoiseSVN-specific solution.
Jason 已经找到了普遍接受的解决方案(由 SVN 人员自己推广的解决方案),但如果您使用 TortoiseSVN 作为客户端,还有另一种选择。 当您在提交对话框中时,右键单击您不想提交的文件,然后选择“添加到更改列表”->“提交时忽略”。 每次您提交它时,它仍然会显示在提交对话框中,但它默认为未选中状态,因此除非您明确选中该框,否则它实际上不会被提交。 再次强调,仅对 Tortoise 有用,因此如果您对非 Tortoise 客户端使用相同的 WC,您会意外地提交它。
Jason already hit on the general accepted solution (the one promoted by the SVN folks themselves), but there is another option, if you're using TortoiseSVN as the client. When you're at the commit dialog, right-click the file you don't want to ever commit and choose Add To Changelist->Ignore On Commit. It will still show up in the commit dialog every time you go to commit it, but it defaults to unchecked so it won't actually be committed unless you explicitly check the box. Again, only useful for Tortoise, so if you use the same WC with a non-Tortoise client, you'll accidentally commit it.