Command-Line Subversion Tutorial, Part 1: The Basics

Posted in Programming and Version Control on Friday, the 20th of March, 2009.

Tagged: , , and

I'm constantly surprised by how many experienced developers are completely unfamiliar with using version control - such as Subversion or CVS - from the command line, instead preferring to rely on graphical clients such as TortoiseSVN.

Don't get me wrong - Tortoise has its uses - but I strongly recommend that any professional developer familiarise themselves with command-line version control. It's simpler, quicker and a thousand times more powerful.

In this post I'd like to help those developers out by covering the basics of command-line Subversion usage, via the svn command. I've optimistically named the post "Part 1" in the hope that I'll manage a follow-up post one day, covering more advanced issues such as merging and resolving conflicts. For now though, let's have a look at the basics.

Comments

Posted by Mohamed on Monday, the 29th of June, 2009.

Thank you a lot, that was very useful for me.

Posted by sathakselva on Friday, the 10th of July, 2009.

Nice tutorial.. Thanks

Posted by Chris on Sunday, the 26th of July, 2009.

You say that using the command line is "a thousand times more powerful" than Tortoise, but I don't see any examples of this in your tutorial. Am I going to have to wait until Part 2?

Posted by Simon Harris on Sunday, the 26th of July, 2009.

Thanks Chris, nice to see a fellow Old Lidunian drop by :) Of course "1,000 times" was merely an artistic flourish, but I'd probably stand by it. Parts 2 and 3 are already online.

Posted by bk1 on Monday, the 31st of August, 2009.

Thanks for the tutorial, helped a lot...

Posted by Khaled on Thursday, the 15th of October, 2009.

Thanks Simon, but do I have to add every new file before making commit. I mean executing "add filename" command before commit?

Posted by Yihui on Tuesday, the 20th of October, 2009.

I have the same question with Khaled. Withe Tortoise, I simply need to check all the new files before commits, but how can we commit all the new files with command line? Writing the file names can be time-consuming...

Posted by John Nuss on Sunday, the 7th of February, 2010.

when I enter the command:
svn co svn://svnrepo/hellosite
I get:svn: Unknown hostname 'svnrepo'

Posted by Kishwar on Wednesday, the 3rd of March, 2010.

Hi John Nuss, I am getting the same error. Have you solved it?

Posted by Simon Harris on Wednesday, the 3rd of March, 2010.

Guys -

In the text, the hostname 'svnrepo' is obviously just an example Subversion repository, invented for the purposes of illustration. You can't connect to it because it doesn't exist. You'd need to have access to your own repository in order to use Subversion.

Posted by Kishwar on Thursday, the 4th of March, 2010.

Hi Simon Haris, I am accessing the repository directly by using "file://" URL. I couldnt understand the function of "svn://" previously. Anyway, thanks for your response.

Posted by Srivatsa on Friday, the 14th of January, 2011.

Damn Neat !!
Thanks a lot for the simple illustration

Posted by Matthew Huckaby on Friday, the 4th of February, 2011.

Thank you, your explanation was lucid and effective.

Posted by Pramod on Thursday, the 2nd of June, 2011.

Very nice and step by step explanation. Nice Job!

Posted by d on Friday, the 28th of October, 2011.

very useful.easy to understand!

Posted by Hammad on Tuesday, the 16th of April, 2013.

Awesome way of explanation

Posted by Subrahmanyam Nilla on Monday, the 5th of August, 2013.

Good Tutorial,
Great Work, Thank you.

Posted by Shaun Thomas on Thursday, the 16th of June, 2016.

Well written tutorial. Good job!

Enter your comment: