Unversioning the Drupal files directory on subversion: committing a directory without its files

Jeremy John's picture

These are the SVN properties that we set for the Drupal files directory. The Drupal files directory needs to exist so that the cache as well as uploaded files can be written there, but versioning all the uploaded files is heavy on resources for little benefit.

Version the directory, but don't version the files our subdirectories within the directory:
svn add --depth empty files

After you commit svn add --depth you use the following to ensure that the files inside aren't accidentally committed
cd to the directory
svn propedit svn:ignore .

Don't forget the dot!

add a "*", and save.

Or, to simply write to the svn:ignore property
svn propset svn:ignore '*' .

Now all the files in the directory will be ignored by subversion.

If you accidentally version all the files, and want to unversion them, but not delete the files, then use:
svn rm /path/to/remove/ --keep-local

Thanks to Alan for these subversion tricks!

Comments

Anonymous's picture

great!