8 years 7 years

Subversion (SVN) is a system for keeping version control of text documents. It makes the task of keeping a group of people synchronized when working on the same code base. It is also an efficient way to synchronize code between a development environment and a production area while keeping track of who changed what.

(A light weight alternative is to use Dropbox. It has some version history built in)

At Gjøvik University College we got access to a SVN server running version 1.6. The address is https://svn.hig.no and you can create personal repositories or shared project repositories.

For master thesis work it is convenient to use the project repository option as it can be shared with other people without giving away your student number and password (It is also against regulation to do so). As they explain, a repository will then be created like this:

https://svn.hig.no/<endyear>/<name>

If you have MAC then you will probably find that subversion is already installed. On Ubuntu you can get it with the package manager or simply:

sudo apt-get install subversion

(You might end up with a newer version than 1.6. Use the "svn upgrade" command as suggested.)

If you are using Windows there is probably some nice graphical program you can get that will guide you through the rest.

In order to get started you need to check out the repository at the server. Use the following command at the working directory of your choice:

svn checkout https://svn.hig.no/year/name/

You will be asked for a password for the username of your account. Type in anything to that you are presented with a fresh username input. Put in your student number and then your password when asked for it. Files will be downloaded into a new directory. Now change to this directory and find a .svn (hidden) folder inside. Do NOT mess with it.

Now move the files and directories you want to keep version control into the root of the new folder created. Here you can use these commands:

svn update Check for new files on server
svn status See the files what has been changed and files that are added but not under control
svn commit -m "comment" Synchronize changes from local storage to the server
svn mkdir foldername Add a new directory
svn rm file Remove a file
svn add path Add file or folder to version control

Note that if you simply add files or delete them without the svn specific commands, they will not be synchronized with the server and this is a good thing. Often when running code temporary files will be created like *.pyc for Python and many files including *.aux files for LaTeX. They will thus not be uploaded. Use the status command to see files with ? meaning they are not under version control.

You can add all files recursively and it is smart to set up an "ignore" list of file types to exclude.

svn add --force directory