I wanted to add a project to Subversion, but I wanted to ignore some of the directories in the project directory.  The standard way to do this would be to add the whole project directory and then set the svn:ignore property to ignore the directories, and then delete them from the repository.  But that adds the directories to svn, and delete doesn’t really delete, so I wanted better.

First, my assumptions:
  • Your repository URL is file:///tmp/foo-repo
  • Your project directory is project1.
  • Your current working directory is project1.
Here's how:
  • svn mkdir -m "Adding just the project1 directory."   file:///tmp/foo-repo/project1
  • svn co file:///tmp/foo-repo/project1 .
    • Don't miss that trailing period!
  • Here you have two choices.  
    • If you want to ignore the directories completely:
      • Add the directory names to "svnignores.txt"
      • svn propset svn:ignore -F svnignores.txt .
    • If you want to ignore the CONTENT of the directories (i.e. to check-in the directories and keep the directory empty in the repository):
      • svn propset svn:ignore '*' directoryName1
      • svn propset svn:ignore '*' directoryName2
  • svn add *
  • svn commit -m "Adding the contents of the project1 directory."