Ignoring files and folders in TortoiseSVN

Ignoring folders using TortoiseSVN is a rather delicate thing. You must consider many factors, such as: whether file is or isn’t already versioned, whether file is needed for running application (i.e. file is junk or differs per computer and you don’t want to put it into repository, but must exist in local folder) etc.

In particular:

1. If you try to ignore non-versioned file (using TortoiseSVN > Add to ignore list) then parent folder will get svn:ignore attribute with folder name, that you want to ignore. But folder will not be deleted.

2. If you try the same on already versioned folder (using TortoiseSVN > Unversion and add to ignore list), the same thing happen to parent folder, but selected folder will be marked as deleted and removed from repository (but not local working copy!) upon next commit. After that, anyone who update or checkout will get contents of repository without that folder.

This is crucial for application junk, temp or assets folders. Which contains not important garbage, which shouldn’t be commited to a repository, but the folder itself must exists or else application will crash.

So, if you know that a folder must be ignored, before you put it under version control, then you simply take steps from point a) above. But, if you need to ignore (not commit) contents of such folder, without deleting it, you shouldn’t ignore the folder itself. Instead you should add “svn:ignore *” to its properties (the one you want to ignore, not the parent one, as in above example!) and commit changes.

This way, anything what will be created inside such folder won’t be commited to repository, but any checkout will bring this folder as well as other ones, making that application should run without any problems.

Leave a Reply