SVN ignoring Git

The first thing I had to deal with was ignoring multiple files in one directory. I’ve always known

svn propset svn:ignore something.txt .

But if you then

svn propset svn:ignore something_else.txt .

it will lose the first ignore. The way to do multiple ignores is annoying:

svn propset svn:ignore "something.txt
> something_else.txt" .

It requires the “s and you have to separate the files with a newline. That’s silly.

So the right way seems to be with an svn ignore file. I created a file “.svnignore”:


(it doesn’t have to be called .svnignore, that just keeps it straight with me exactly what it is)

Then the following command needs to be run:

svn -R propset svn:ignore -F .svnignore .

and this will recursively run through every directory in “.” and ignore every pattern in the file. The only issue is any time new directories are added that contain git (i.e. submodules) the command will have to be re-run.


  1. Ofer says:

    It would have been helpful if you specified when to use this.
    For example, I have pulled files from github and now I want to add the files to an existing svn repository.
    What are the stages?

    The normal stages would be:
    1) cd /some_svn_path/
    2) svn add /some_svn_path/files_from_git
    3) svn commit /some_svn_path/

    where would I add the propset command?


    • JaZahn says:

      1) init the svn repo on the svn server
      2) pull down the empty repo (svn checkout blah) so you’ll have the .svn dir in your project root.
      3) clone the git
      4) create the .svnignore file
      5) svn -R propset svn:ignore -F .svnignore .
      6) svn add *
      7) svn commit -m “first commit”

      You have to use this when using both systems concurrently. In transfers, it’s easier to just drop the .git files. But with a transfer, you’re sort of giving up on the idea that you’ll be contributing back to the git. In effect, you’ll be going back in time! (because git has made svn legacy tech)

Leave a comment