Icon_search

Excluding Files from a Subversion Repository with svn:ignore

Posted on 01/25/2009 by Travis
 | 

Sometimes, you need to exclude certain files or folders from your Subversion repository. This is usually just as simple as not adding the files via svn add. But, those files and folders still show up when you run svn status as non-tracked files. This may be fine for most people, but what if you want to mark those files as excluded and never see them again (at least via Subversion commands)? That's where the svn:ignore property comes in handy.

Let's say you'd like to exclude all files in the log folder.

svn propedit svn:ignore log/

Then just add * as the entry to ignore all files in that folder. You can also set file patterns to ignore all types of files and folders.

NOTE: If you get the following error:

svn: None of the environment variables SVN_EDITOR, VISUAL or EDITOR is set, and no 'editor-cmd' run-time configuration option was found

You need to set your SVN_EDITOR. For a one-time workaround, you can run one of the following commands to set your default svn editor:

If you want to permanently set your svn editor, you can add an entry to your ~/.bash_profile file (on Mac only).

As a bonus, you can see all of the excluded files by running svn status --no-ignore.

Tagged:  subversion, svn