'How do you include/exclude a certain type of files under Subversion?
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?
Solution 1:[1]
This can be achieved using the svn:ignore property, or the global-ignores property in your ~/.subversion/config file. (Scroll to the top of that first link to see instructions on editing properties.)
By using svn propset or svn propedit on a directory, you will be able to make Subversion ignore all files matching that pattern within the specific directory. If you change global-ignores in ~/.subversion/config's [miscellany] section, however, Subversion will ignore such files no matter where they are located.
Solution 2:[2]
See blog post svn:ignore.
I know using TortoiseSVN that I can click on a root folder where I have something checked out and can add arbitrary properties by selecting the "Properties" menu item. In this case you would just specify file patterns to exclude.
The blog post for command line stuff, but I'm sure it will work fine with whatever client you're using.
Solution 3:[3]
At the lowest level, SVN allows you to ignore certain files or patterns with svn:ignore attribute. VS add-ins for SVN such as VisualSVN will automatically ignore those files on your behalf. If you're using TortoiseSVN, you can right-click files and folders in Explorer and choose Add to Ignore List.
Solution 4:[4]
Another way, when using TortoiseSVN, you can select "Commit..." and then right click on a file and move to changelist "ignore-on-commit".
Solution 5:[5]
Using the svn:ignore property, you can use wildcards.
Solution 6:[6]
If you use Eclipse (I use Spring Tool Suite):
Preferences > Team > Ignored Resources
click on Add Pattern, write .DS_Store (or whatever) and Save.
This acts globally in your workspace.
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
| Solution | Source |
|---|---|
| Solution 1 | Peter Mortensen |
| Solution 2 | Peter Mortensen |
| Solution 3 | Tim Cooper |
| Solution 4 | John Henckel |
| Solution 5 | Peter Mortensen |
| Solution 6 | mwarren |
