Getting Started With Subversion - Presentation Transcript
Getting started with Subversion Jordan Hatch
What is subversion? Version control system Open Source Easy to set up
Why Version Control?
Keep Project organised File and project history Works with any text-based files More than one person editing Easy to branch/merge projects Small footprint on server
A Backup System Rollback changes on files Find out who changed what!
Setting Up Subversion
Choose the server… svnserve Easy to set up Can be used with SSH Apache HTTP Server Harder to set up HTML repository browsing Multiple authentication methods
svnserve Available for multiple platforms Windows: http://tortoisesvn.net/docs/release/TortoiseSVN_en/tsvn-serversetup-svnserve.html Mac: http://developer.apple.com/mac/library/documentation/Darwin/ Reference/ManPages/man8/svnserve.8.html Linux Package Manager
Creating a repository Linux & Mac OS X: $ svnadmin create /home/jordan/repo Windows: svnadmin create C:Repo
Choose A Client… Command Line! “Out of the box” SVN support on Mac OS X Easy to install on Linux Binaries for Windows – http://subversion.tigris.org/ GUIs Tortoise SVN – Windows only IDE Plugins Versions App for Mac
SVN Basics
Repository layout No forced structure Most commonly-used way…
REPOSITORY LAYOUT trunk – Main project development branches – Experimental and release branches tags – “Snapshot” of a project
Checking out Project $ svn checkout /path/to/repo/project A myproject/page.php A myproject/style.css A myproject/includes A myproject/includes/db.php Checked out revision 1.
Committing changes $ svn status A myproject/login.php A myproject/logout.php M myproject/page.php M myproject/style.css M myproject/includes/db.php
Resolving Conflicts $ svn status C myproject/login.php
Resolving Conflicts Four ways of resolving conflicts: Overwrite with your version of the file Overwrite with the existing version Merge the changes manually Merge using a merge tool
RESOLVING CONFLICTS $ svn resolve --accept working myproject/login.php Resolved conflicted state of ‘myproject/login.php' $ svn commit -m “Added login session check.” Sending myproject/login.php Transmitting file data . Committed revision 6.
Creating Branches & Tags It’s just a copy of a folder… Merge changes back into trunk later $ svn copy /project/trunk /project/branches/1.0 $ svn copy /project/trunk /project/tags/1.0 $ svn copy /project/branches/1.0 /project/tags/1.1
SVN Examples
Release branches Used often in open source projects Very flexible Allows for maintenance releases while core is worked on for next major release.
Seen in the wild… WordPress’ SVN Zend Framework SVN
Branching Concepts Feature Branches Allows for experimentation Vendor Branches Keeping track of code libraries Allows for modifications to suit your needs
Conclusion You need version control! SVN is open-source and (fairly) easy to set up… Use branches and tags to experiment with your code. Organise it however you like.
And IF You Get Stuck… http://svnbook.red-bean.com Everything you need to know about SVN.
Thanks (: Jordan Hatch - @1jh http://www.jordanh.net/
0 comments
Post a comment