Getting Started With Subversion


Published on

My talk at BarCamp Blackpool on Subversion.

Published in: Technology
  • Be the first to comment

No Downloads
Total views
On SlideShare
From Embeds
Number of Embeds
Embeds 0
No embeds

No notes for slide

Getting Started With Subversion

  1. 1. Getting started with Subversion<br />Jordan Hatch<br />
  2. 2. What is subversion?<br />Version control system<br />Open Source<br />Easy to set up<br />
  3. 3. Why Version Control?<br />
  4. 4. Keep Project organised<br />File and project history<br />Works with any text-based files<br />More than one person editing<br />Easy to branch/merge projects<br />Small footprint on server<br />
  5. 5. A Backup System<br />Rollback changes on files<br />Find out who changed what!<br />
  6. 6. Setting Up Subversion<br />
  7. 7. Choose the server…<br />svnserve<br />Easy to set up<br />Can be used with SSH<br />Apache HTTP Server<br />Harder to set up<br />HTML repository browsing<br />Multiple authentication methods<br />
  8. 8. svnserve<br />Available for multiple platforms<br />Windows:<br />Mac: Reference/ManPages/man8/svnserve.8.html<br />Linux Package Manager<br />
  9. 9. Creating a repository<br />Linux & Mac OS X:<br />$ svnadmin create /home/jordan/repo<br />Windows:<br />svnadmin create C:Repo<br />
  10. 10. Choose A Client…<br />Command Line!<br />“Out of the box” SVN support on Mac OS X<br />Easy to install on Linux<br />Binaries for Windows –<br />GUIs<br />Tortoise SVN – Windows only<br />IDE Plugins<br />Versions App for Mac<br />
  11. 11. SVN Basics<br />
  12. 12. Repository layout<br />No forced structure<br />Most commonly-used way…<br />
  13. 13.
  14. 14. REPOSITORY LAYOUT<br />trunk – Main project development<br />branches – Experimental and release branches<br />tags – “Snapshot” of a project<br />
  15. 15. Importing Your Project<br />$ svn import myproject /path/to/repo <br /> -m “Importing my project”<br />Adding myproject/page.php<br />Adding myproject/style.css<br />Adding myproject/includes<br />Adding myproject/includes/db.php<br />Committed revision 1.<br />
  16. 16. Checking out Project<br />$ svn checkout /path/to/repo/project<br />A myproject/page.php<br />A myproject/style.css<br />A myproject/includes<br />A myproject/includes/db.php<br />Checked out revision 1.<br />
  17. 17. Committing changes<br />$ svn status<br />A myproject/login.php<br />A myproject/logout.php<br />M myproject/page.php<br />M myproject/style.css<br />M myproject/includes/db.php<br />
  18. 18. Committing Changes<br />$ svn commit -m “Added login page.”<br />Sending myproject/login.php<br />Sending myproject/logout.php<br />Sending myproject/page.php<br />Sending myproject/style.css<br />Sending myproject/includes/db.php<br />Transmitting file data . <br />Committed revision 3. <br />
  19. 19. Resolving Conflicts<br />$ svn status<br />C myproject/login.php<br />
  20. 20. Resolving Conflicts<br />Four ways of resolving conflicts:<br />Overwrite with your version of the file<br />Overwrite with the existing version<br />Merge the changes manually<br />Merge using a merge tool<br />
  21. 21. RESOLVING CONFLICTS<br />$ svn resolve --accept working myproject/login.php<br />Resolved conflicted state of ‘myproject/login.php&apos; <br />$ svn commit -m “Added login session check.”<br />Sending myproject/login.php<br />Transmitting file data . <br />Committed revision 6. <br />
  22. 22. Creating Branches & Tags<br />It’s just a copy of a folder…<br />Merge changes back into trunk later<br />$ svn copy /project/trunk /project/branches/1.0<br />$ svn copy /project/trunk /project/tags/1.0<br />$ svn copy /project/branches/1.0 /project/tags/1.1<br />
  23. 23. SVN Examples<br />
  24. 24. Release branches<br />Used often in open source projects<br />Very flexible<br />Allows for maintenance releases while core is worked on for next major release.<br />
  25. 25. Release Branches<br />tags<br />1.0<br />1.0.1<br />1.5<br />1.5.1<br />1.7<br />branches<br />1.7<br />1.5<br />1.0<br />trunk<br />
  26. 26. Seen in the wild…<br />WordPress’ SVN<br />Zend Framework SVN<br />
  27. 27. Branching Concepts<br />Feature Branches<br />Allows for experimentation<br />Vendor Branches<br />Keeping track of code libraries<br />Allows for modifications to suit your needs<br />
  28. 28. Conclusion<br />You need version control!<br />SVN is open-source and (fairly) easy to set up…<br />Use branches and tags to experiment with your code.<br />Organise it however you like.<br />
  29. 29. And IF You Get Stuck…<br /><br />Everything you need to know about SVN.<br />
  30. 30. Thanks (:<br />Jordan Hatch - @1jh<br /><br />