Subversion ignore for Rails applications
Files in subversion workspaces can be ignored using the command:
svn propset svn:ignore <pattern> <folder>
Note however that properties do not stack! If you execute the following:
svn propset svn:ignore "*.sqlite3" db svn propset svn:ignore "schema.rb" db
then the second ignore statement will overwrite the first. To ignore multiple files, you must provide a newline separated list; The most straightforward way to do this is to create a file, e.g. ignores.txt
*.sqlite3 schema.rb
then provide this to subversion:
svn propset svn:ignore -F ignores.txt db
However if you know what you are doing you can do this on one line. Using bash on Mac OS, typing Ctrl-V Ctrl-M will insert a newline into a string. Putting in a \n, or just typing \ and then hitting enter, does not work.
There is also a way to set global ignores in subversion. Edit you ~/.subversion/config file and add a global-ignores line:
global-ignores = *.o *.lo *.la #*# .*.rej *.rej .*~ *~ .#* .DS_Store
- .DS_Store files are generated by the Mac OS X Finder, and therefore as they are platform specific, we should let the user responsible for the platform take care of them using global ignores statement shown above.
- Files which are going to be generated by ALL developers should be ignored by the repository itself, using svn propset svn:ignore.
- Ignore log files, sqlite3 databases, temporary files.
- The db/schema.rb file is questionable. You can use it to recreate your database in one step, and it should only change when you alter a migration. However in practice it seemed like it used to change a lot more often than that (like when you ran a migration), so was a pain to version. It looks like that is fixed now, so let’s keep it.
- For applications deployed in multiple places and for which the subversion repository is not secure, ignore database.yml
svn propset svn:ignore "*.sqlite3" db svn propset svn:ignore "*.log" log svn propset svn:ignore "*" tmp/sessions tmp/cache tmp/sockets
