我有一个大部分需要忽略的目录。它的一个文件很特殊,我想将它包含在版本控制系统中。要忽略的文件夹hw-description名称是 ,我要保留的文件名称是system.hdf。
我可以使用 将其添加hw-description到svn:ignore列表中TortoiseSVN -> Properties -> svn:ignore,并且它可以正常工作。即使,我追加!system.hdf到下一行,该文件仍然被忽略。
这样做的方法是什么?
使用svn命令行工具的解决方案
正如罗伯特在下面所说,我不应该忽略包含文件夹。通过将svn:ignore文件夹的属性设置为*. 因此,我只将system.hdf文件添加到版本控制中,而忽略了文件夹的其余部分。以下是它的相关命令:
# Add the folder to version control excluding the content
svn add hw-description/ --depth empty
# Add the specific file to version control
svn add hw-description/system.hdf
# Ignore the rest of the files via svn:ignore property
svn propset svn:ignore "*" hw-description/
请注意,在运行上述命令之前,必须将父文件夹添加到 SVN。