bashsvnsvnignorerabbitvcs

How do I exclude a single file from svn:ignore?


I've got a directory that needs to be ignored mostly. One of its files is special and I want to include it in the versioning system. The name of the folder to be ignored is hw-description, and the name of the file that I want to preserve is system.hdf.

I can add the hw-description to the svn:ignore list using TortoiseSVN -> Properties -> svn:ignore, and it works properly. Even though, I append !system.hdf to the next line, the file is still ignored.

What is the way of doing that?

Solution using the svn command-line tool

As Robert stated below, I should have not ignored the containing folder. Only the contents should have been ignored via setting the svn:ignore property of the folder as *. Therefore, I added only the system.hdf file to version control and ignored the rest of the folder. Here are the related commands for it:

# 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/

Be aware that the parent folder must have been added to SVN before running the commands above.


Solution

  • You should not ignore the whole folder, I would manually add the one file to SVN and commit it and then in that folder add an ignore entry for *.

    As ignore entries do not affect already added files the one file will remain as it is and other files are ignored.