quick SVN tutorial for end-users

There are lots of resources on the web about SVN. so, this page is just a quick summary of the 4-5 commands you will need to start with.

The following commands are for linux users (and therefore Mac users who have access to a linux command line interface).

A SVN repository is a centralised repository within an external server. You, as a user can access to this repository to obtain all its contents and to commit changes or new content.

So, first, you need the name of the repository. Let us suppose that the server is https://server and that the name of the repository is project.

Then, you can check out the entire repository on your hard disk inside a directory called project (you can name it differently if you want):

svn co https://server/project project

Go into the project directory. You can add a new file:

svn add example.py

edit your file and when you are happy with it, you can just commit it into the server so that other users can access to it:

svn commit example.py -m "some meaningful comments for bookkeeping"

Note that we used the option “-m” to provide a comment.

If you want to delete a file,

svn delete example.py

Right now, it is only deleted locally, so if you want this change to be reflected on the server, you must now commit the changes:

svn commit -m "delete a file"

Keep in mind that you can perform these commands on several files at the same time. For instance,

svn add file1.py file2.py
svn commit file1.py file2.py

If you simply type

svn commit

without files, then SVN will search for all the new files and all the modified files and will commit them on the server.

You may want to know what are the new or modified files before a commit. This can be done with the following command:

svn status

Finally, one of the interest of SVN is that you can track the difference between your directory and the server directory. For instance if you’ve modified your file example.py and wonder how different it is from the server, type

svn diff example.py

If you can not commit a file, usually it is because you do not work on the lastest version of the file. So,
you must update first:

svn update

This happens when one of your collaborators committed a new version of the file you are working on.

To perform a dry-run update in order to see if someone modified a file, type

svn status -u
Please follow and like us:
This entry was posted in Computer Science and tagged . Bookmark the permalink.

Leave a Reply

Your email address will not be published.