How to include/exclude a certain type of files under Subversion

svnversion control

I'm getting confused with the include/exclude jargon, and my actual SVN client doesn't seem to have (or I've been unable to find it easily) a simple option to add or remove a certain type of files for version control.

Let's say for example I've added the entire Visual Studio folder, with its solutions, projects, debug files, etc., but I only want to version the actual source files. What would be the simplest way to do that?

Best Answer

You're probably safest excluding particular filetypes, rather than picking those you want to include, as you could then add a new type and not realize it wasn't versioned.

On a per-directory basis, you can edit the svn:ignore property.

Run

svn propedit svn:ignore .

for each relevant directory to bring up an editor with a list of patterns to ignore.

Then put a pattern on each line corresponding to the filetype you'd like to ignore:

*.user
*.exe
*.dll

and what have you.

Alternatively, as has been suggested, you can add those patterns to the global-ignores property in your ~/.subversion/config file (or "%APPDATA%\Subversion\config" on Windows - see Configuration Area Layout in the red bean book for more information). In that case, separate the patterns with spaces. Here's mine. # at the beginning of the line introduces a comment. I've ignored Ankh .Load files and all *.resharper.user files:

### Set global-ignores to a set of whitespace-delimited globs
### which Subversion will ignore in its 'status' output, and
### while importing or adding files and directories.
# global-ignores = *.o *.lo *.la #*# .*.rej *.rej .*~ *~ .#* .DS_Store
global-ignores = Ankh.Load *.resharper.user