Check out "Do you speak JavaScript?" - my latest video course on advanced JavaScript.
Language APIs, Popular Concepts, Design Patterns, Advanced Techniques In the Browser

SVN: Ignoring files and directories

I really like GIT and I think that is a better version control system than SVN. Anyway, I still have to use SVN for some projects and ignoring files is always a problem.

To ignore a file use the following command:

  svn propset svn:ignore yourfile.ext yourdirectory
  

So, to ignore files in SVN you should set svn:ignore property of the directory that holds the file. For example in my case the command was:

  svn propset svn:ignore database.php ./application/settings/
  

Have in mind that once the file is commited to the version control the ignoring will not work. If you run

svn status

you will see that your file is still there. You should remove it from the repository with svn delete. I.e. something like that:

  svn delete --force application/settings/database.php
  

(notice the usage of --force parameter) This of course leads to more problems, because all the other developers will run svn update and their local copy of the file will be deleted. So, they should make a backup of the file and restore it later. To ignore a whole directory use

  svn propset svn:ignore yourdirectory parentdirectory
  

If the folder is in the root of your project use

  svn propset svn:ignore yourdirectory .
If you enjoy this post, share it on Twitter, Facebook or LinkedIn.