Live Chat!

svn command line tutorial for beginners 1

7 votos Vota!!

April 17th, 2007 mysurface Posted in Developer, svn, svnadmin, svnlook | Hits: 102998 |

svn can be known as subversion, it is a version control system after cvs. It claims to be out perform cvs, one of the features of svn is it do support versioning for documents and binaries beside source code.

As you search for subversion, it may lead you to the page of http://tortoisesvn.tigris.org/. Tortoise is a windows client of svn, you can even create svn repo using tortoise. Tortoise incorporate with windows explorer well, therefore it is easy to use.

When I migrate my svn repository to Linux, I couldn’t find any svn client that as easy as tortoise in windows. I was a bit upset at first. But not more for now, I have learn the way to cope with svn command line. I feel more control on it as in the sense that I know what am I doing by using command line compare to using GUI.

This post is not going to focus on svn installation, as the installation is available anywhere, let me list some links for you in case you are actually looking for installation.


 

Subversion Installation References

  • Installing Subversion (svn) on Linux (Debian Stable)
  • Setting up Subversion and websvn on Debian
  • How To Configure Web Access To Subversion Repositories Using Apache
  • Install SVN with Web Access on Ubuntu
  • The aim of this tutorial is to guide beginners for using svn command line with simple examples. As I am newbie as well for now, I urge you to notify me if you find some mistake I have made or you have better techniques to share.

    Lets get it started….

    How to get help with svn?
    If you are looking for svn reference in man pages, you have gone to the wrong place. To check the references of svn commands, simple do this:

    svn help

    This will make svn list all the available functions, to get the function reference, let say checkout

    svn help checkout

    The same thing goes to other svn related commands, such as svnadmin

    svnadmin help

    How to create a svn repository?
    First of all what is repository? It is a core file for svn, or you can call it a centralized svn backup database. After created it, it is just a directory with its files. IMPORTANT! Do NOT try to modify or add something into the repository, unless you know what are you doing.

    To create a svn repo, let say I wanna create a repo to store all my programming codes, I do this

    svnadmin create /home/mysurface/repo/programming_repo

    Remember try to use absolute path for everything, sometimes the relative path is not going to work.

    How to import my existing directories into the new repo?

    svn import /home/mysurface/programming file:///home/mysurface/repo/programming_repo -m "Initial import"

    -m stand for log message, the first revision was created with log as “Initial import”. You need to specified URL for the repo, URL is the standard argument for svn. Therefore for local file, you need to specified with file://

    How to see what is inside the repo?

    svn list file:///home/mysurface/repo/programming_repo

    Another way of listing all the files and folder in the tree view, I use svnlook

    svnlook tree programming_repo 

    The difference between svn list and svnlook tree is one expect URL another one do not.

    svn command line tutorial for beginners 2 will covers how to checkout, track changes, commit, add or delete files and message logs.

    Continue reading next post ….

    13 Responses to “svn command line tutorial for beginners 1”

    1. [...] This is the continues tutorial for svn command line tutorial for beginners 1. The previous post covers Introduction of subversion, installation links, how to get help, create svn repository, import files into a new repository and list the files inside a repo. [...]

    2. [...] surface from Linux by Examples has written two ‘getting started for SVN’ articles that I find it interesting and useful for beginners. [...]

    3. Tim Arnold-Moore Says:

      The English in this tutorial could do with some editting. I find the grammar errors extremely distracting. I’d be happy to do this.

    4. [...] svn command line tutorial for beginners 1  Category: Cheatsheets  |  Comment (RSS)  |  Trackback [...]

    5. [...] svn command line tutorial for beginners 1 [...]

    6. @Arnold-Moore Perhaps this was written with search engines in mind as the English is very broken.

    7. Arnold, Owen:
      The English may consider very broken, but yet the message is delivered. English is not my native language (I know the excuses is lame, well I improves my english.) and NO, I do not write for SEO.

    8. @mysurface, well it does definitely get the point across. Its a good tutorial!

    9. Great tut..thanks

    10. I always forget this, therefore here I make a note.

      Let say I have a wanna check in a folder to existing projects into svn. My folder is recv and my svn url is https://svn/projects/mysummer/

      I need to use import,
      svn import recv https://svn/projects/mysummer/recv

    11. Good one..simple and clean.

    12. Sometimes svn url path may change due to the server relocation etc. To remap back the svn path we can use svn switch –relocate

      First check the old url path with svn info next do the switch

      svn switch –relocate

      i.e.
      svn switch --relocate https://udklstr1/SWITCHING/generic/SunManager/trunk https://10.162.24.3/svn/SWITCHING/generic/SunManager/trunk

    13. good …but i’ve problem while using svnlook tree mydir_name

      error: can’t open file svn/format: No such file or Directory, but when I checkin the folder, it is there.

      I created a folder name svn in this location /root/Desktop.

    Leave a Reply

    Security Code: