How to include / exclude a specific file type in Subversion?

I got confused with the include / exclude jargon, and my actual SVN client does not seem to have (or I couldn’t easily find it) a simple option to add or remove a specific type of file for version control.

Say, for example, I added the entire Visual Studio folder with its solutions, projects, debug files, etc., but I only want to update the actual source files. What would be the easiest way to do this?

+43
version-control svn
Sep 23 '08 at 17:02
source share
6 answers

You are probably safer to exclude certain types of files, rather than collecting the ones you want to include, since then you can add a new type and not realize that it was not a version.

In each directory, you can edit the svn: ignore property.

Run

svn propedit svn:ignore . 

for each corresponding directory to call the editor with a list of templates to ignore.

Then place the template on each line corresponding to the type of file you want to ignore:

 *.user *.exe *.dll 

and what do you have.

Alternatively, as suggested, you can add these patterns to the global-ignores in the ~ / .subversion / config file (or "%APPDATA%\Subversion\config" on Windows - see Configuring the configuration area in the red bean book for more information ). In this case, separate the patterns with spaces. Here is mine. # comment is entered at the beginning of the line. I ignored the Ankh.Load files and all the * .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 
+55
Sep 23 '08 at 17:06
source share

This can be achieved using the svn: ignore property or the global-ignores property in your ~/.subversion/config file. (Scroll to the top of this first link for instructions on editing properties.)

Using svn propset or svn propedit in a directory, you can force Subversion to ignore all files matching this pattern in a specific directory. However, if you change the global ignore in the ~/.subversion/config [miscellany] section, Subversion will ignore such files no matter where they are.

+5
Sep 23 '08 at 17:05
source share

See the svn blog post : ignore .

I know, using TortoiseSVN, that I can click on the root folder, where I checked something and can add arbitrary properties by selecting the "Properties" menu item. In this case, you simply specify the file templates to exclude.

A blog post for the command line, but I'm sure it will work perfectly with any client you use.

+2
Sep 23 '08 at 17:07
source share

At the lowest level, SVN allows you to ignore specific files or templates with the svn: ignore attribute. VS add-ons for SVN such as VisualSVN will automatically ignore these files on your behalf. If you use TortoiseSVN , you can right-click the files and folders in Explorer and select "Add to ignore list".

+1
Sep 23 '08 at 17:05
source share

Using the svn:ignore property, you can use wildcards.

+1
Sep 23 '08 at 17:05
source share

Another way: when using TortoiseSVN, you can select "Commit ...", and then right-click on the file and go to the "ignore-on-commit" change list.

+1
Sep 19 '16 at 18:28
source share



All Articles