TortoiseSVN committed a file like myapp.pdb or Thumbs.db. Now what?

A very specific rule for using source control is to avoid putting temporary files, user files, or compiled content into the repository.  These files change far too frequently and offer little value to the versioning and historical process.  More than anything, they’ll just make the repository excessively large and make everyone update their checked out copies more.  However, keeping temporary files out of SVN using TortoiseSVN isn’t a perfect science.

TortoiseSVN will suck in everything in the folder, including hidden files and folders. Windows hides the Thumbs.db file – a cache of image thumbnails in the folder. To see this file, open the folder in Windows Explorer, choose Tools menu -> Folder Options -> View tab -> Show hidden files and folders. Now that you can see it in Windows Explorer, you can delete it from SVN in the standard way. Standard caveat though: it deletes it from now on in the checked out trunk, it doesn’t delete the history of the file being there, and by deleting it, you won’t make the repository smaller.

A more industrial-strength way to avoid files like this from entering the repository is to adjust TortoiseSVN’s settings. From Windows Explorer, right-click, choose TortoiseSVN -> Settings. In the General section, there’s a “Global ignore pattern”. Mine currently looks like this:

bin obj CVS .cvsignore *.user *.suo Debug Release *.pdb test.*

This is just a space-delimited list of file patterns to ignore. You can add Thumbs.db here or any other file mask that you’d like Tortoise to ignore when checking in files.  (Since I disabled creation of Thumbs.db on my system, I don’t yet have it in the list.  You also may not need the CVS patterns if you have no legacy CVS content hanging around.) The lynch pin here though is this is a per-svn-client setting, not per-project or per-folder. If someone else in the team checks out the source, builds it, and checks it in, if they weren’t paying attention, they’ll likely push these unwanted files into the repository. (My solution to that is to hand the global ignore pattern list to everyone in the team.)

If you’d like a server-side solution, with the files not checked in (or previously removed, committed, and rebuilt), you can right-click on them in Windows Explorer, choose TortoiseSVN, and Ignore. You can also do this by right-clicking on them in the Tortoise’s commit screen. The up-side is this is server-side, so it applies to all users of this file or folder. The down-side is this is per-file. So, each new project, new solution, or new directory added to the repository needs some TLC right out of the gate to insure it doesn’t commit these files into the repository.

Which of these two is the best strategy for ignoring these files and folders?  The first is great for many folders and few people or people that don’t change much.  The latter is good for many people and few folders or for teams that have high turnover.  But as always, your mileage may vary, and your comfort with each paradigm may temper your success.