svn 忽略文件但将其包含在结帐中 [英] svn ignore a file but include it in checkout

查看:24
本文介绍了svn 忽略文件但将其包含在结帐中的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我在存储库中有一个项目.人们很快就会开始检查它,处理它,然后提交他们的更改.但是该项目中有一个文件(我自己设计的精心设计的配置文件),每个人都必须拥有一份副本,但他们将对其进行更改,这些更改永远不应重新签入(即永远不应将其发送)通过更新回存储库).

I have a project in a repository. People will soon start checking it out, working on it, then committing their changes back. But there is one file within that project (an elaborate configuration file of my own design) that everyone simply must have a copy of, but they will make changes to it that should never ever be checked back in (that is never should they be sent via update back to the repository).

所以,我希望每个签出项目的用户都能接收这个配置文件,但我希望它在所有提交时都被忽略.

So, I want each user who checks out the project to receive this config file, but then I want it ignored on all commits.

到目前为止我所读到的内容让我觉得这是不可能的.似乎一旦我用这个配置文件导入了项目,它就处于版本控制之下,除了删除它之外,没有办法再忽略它.

What I've read so far makes me feel this is not going to be possible. It seems that once I've imported the project with this config file it is under version control and there is no way anymore to ignore it other than removing it.

我希望我只是误解了,解决方案很简单.

I hope I just misunderstood and the solution is an easy one.

有人可以帮忙吗?

哦,如果可能的话,我需要一个命令行解决方案.许多工作是在仅具有 ssh 连接的无头 linux 机器上完成的.

Oh, I need a command line solution please if possible. A lot of the work is done on headless linux boxes with ssh-only connections.

谢谢!

编辑:我采用了 cdhowie 的回答.除了按照他的建议创建模板配置文件(例如 app.config.template)之外,我还使用svn propedit svn:ignore"来在提交时忽略真实的配置文件名(例如 app.config).

EDIT: I went with cdhowie's answer. In addition to creating a template config file (for example app.config.template) as he suggests, I also use the "svn propedit svn:ignore" to have the real config file name (for example app.config) ignored on commits.

推荐答案

通常您执行此操作的方式是提供一个模板文件,用户或脚本将复制到它所属的位置.然后该文件将被忽略.

Usually the way you do this is by providing a template file that the user or a script will copy to where it belongs. That file will then be ignored.

例如,假设您有 app.config 作为配置文件.你可以将你的提交为 app.config.template 或类似的东西.用户必须复制并重命名文件才能开始开发.app.config 在 SVN 中将被忽略.

For example, say you have app.config as the config file. You would commit yours as app.config.template or something similar. Users would have to copy and rename the file to begin development. app.config would be ignored in SVN.

这对于更新来说并不干净,但它是您可以获得的最好的.另一种选择是在存储库中设置访问限制,以便其他人无法更改 app.config.

This doesn't work cleanly for updates, but it's about the best you can get. Another option would be to set access restrictions in the repository so that app.config cannot be changed by anyone else.

我说过这对于更新来说并不干净,但是再想一想,如果开发人员无论如何都在大量更改此文件,他们可能不希望您进行更新他们自己的设置.对您的开发人员来说,使用模板文件实际上会更容易,因为他们可以自行选择要合并的更改.

I said that this doesn't work cleanly for updates, but on second thought, if the developers are changing this file a lot anyway, they probably don't want updates from you clobbering their own settings. Using a template file will actually be easier on your developers, since they can pick which changes to merge in themselves.

这篇关于svn 忽略文件但将其包含在结帐中的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆