Keeping .DS_Store files at bay

.DS_Store files are to Mac what Thumbs.db are to Windows: annoying, meaningless and worst of all, ubiquitous. Whenever you browse to a folder which contains certain magic files or you do something like moving an icon to a certain position, they system will create those files in the folder. Then you happily type in git status, or svn status, when lo and behold! those defiant .DS_Store files are there, waiting to be added to your repository.

So you type this in, frantically:


find . -name ".DS_Store" -delete

and then before it happens again, you edit your .gitignore file (which as the user's manual helpfully points out, should be in the top level of your working directory) and make sure it contains the following lines:


# Ignore useless stuff
.DS_Store

Or if you're using subversion, you can set the svn:ignore property:


svn propset svn:ignore .DS_Store .

You may want to make sure there isn't a previous value for svn:ignore with svn propget svn:ignore . and if that's the case, probably "merge" them so that you don't lose those values.

While we are on it we could also add Thumbs.db to the list, but since I haven't used a Windows system for developing in a long time, I don't need to do that (lucky me!)