Adding a directory to subversion, and ignoring the directory contents

Sometimes when committing things to svn you want to commit a directory, but ignore all of the files inside it. The /sites/default/files/ directory within Drupal is a perfect example. Here's how:

  1. Add the directory, while ignoring all of the files it contains:
    svn add -N [directory]
  2. After adding the directory enter the directory and run the following command:
    svn propset svn:ignore '*.*' .
  3. Commit your changes:
    svn commit -m "Added the directory and set the files within it to be ignored"

All better now...!

Comments

Hi there,

Would you happen to know how to svn add a directory that contains blank spaces in its title? For example:

svn add User accounts

where 'User accounts' is the directory title.

Many thanks and kind regards,

Besnique

this is exactly what i was looking for, thanks

This doesn't cover sub directories inside the directory. For that you need svn propset svn:ignore '*' .

Add new comment