Thursday, July 28, 2011

SVN : tips and tricks

1. Checkout only a single file from repository without having to download the entire directory.

Sometimes we want to work on only a single file out of 1000's of files in a repository folder. You don't have to download them all. You can do this

svn co --depth empty
cd
svn up
Thanks to source here

2. When you access subversion from Eclipse you will be prompted for username and password. You can select an option to cache the password so you don't have to enter them every time you connect to repository. Suppose if you want to reset the cache and to be prompted for password again, you need to manually delete the file containing the cached password. In Mac OSX, its

~/.subversion/auth/.svn.simple

Now restart the IDE, you will be prompted for password again.


3. If you want to ignore certain files from ever "accidentally" checked in to SVN, do the following. I'm talking about those .settings, .classpath, .project, target, log server.out, depedency-reduced-pom.xml, etc.

  1. Go to ~/.subversion/config file
  2. Find "global-ignores" line. It would be commented by default.
  3. Add this instead "global-ignores = *.classpath *.project *.settings target

The location of config file based on the system:

In Mac/Linux:

~/.subversion/config or /etc/subversion/config

In Window:

%appdata%\subversion\config