Ignore Files and Directories in Subversion

snubbed by Rennett Stowe

In the course of a project there are always files and directories that you don’t want to check in but which Subversion complains it doesn’t know anything about them.  So it makes sense to tell Subversion to ignore them, in other words, keep quiet. 🙂

The mechanism for doing this works okay but I wouldn’t say it’s perfect.

This is how I do it.

  1. Go to the directory where want to ignore a file or subdirectory.
  2. Issue the command
    svn propedit svn:ignore .
  3. Your editor then will be launched and you can enter one line at a time those files and/or subdirectories you want to ignore.
    some_file
    some_directory
  4. Commit your changes.
    svn commit -–depth empty

    Two things to notice.

    1. --depth empty argument

      only commit the propedit changes

    2. Committing your changes means everyone will end up ignoring these files and/or directories so make sure you are ignoring the right ones.
  5. If you don’t want to commit your changes you can revert them.
    svn revert .

For further reading please see Pete Freitag’s blog post Ignore Files and Directories in Subversion.