This document provides an overview of using Subversion (SVN) for version control of software projects. It demonstrates how to [1] create an SVN repository and import an initial project, [2] check out a working copy to make changes, [3] commit changes back to the repository, [4] allow multiple developers to collaborate by updating and committing changes, [5] branch and tag different versions, and discusses the benefits of using SVN like unlimited undo capabilities and enforcing structured development.
3. The initial work
Let’s assume we have just made a quick and dirty hack, which we
now want to put under version contol for further development:
> ls /my/hack
16. ...but it pretends to make a new copy on every commit.
Repository
4
3
2
1
17. Sometimes it may be useful to branch the project...
> svn cp -r 2 file:///my/repos/hack/trunk
file:///my/repos/hack/branches/mad
18. ...this creates a copy directly in the repository.
4
3
.../trunk .../branches/mad
2 5
1
19. Check out a working copy of the branch
> svn checkout file:///my/repos/hack/branches/mad
/work/mad-hack
20. You can now safely experiment with mad-hack, while
maintaining a stable version of hack in the trunk.
4
> cd /work/mad-hack
> # edit it 3 6
2 5
1
> svn commit
21. Tagging: You can also use the branching mechanism to
mark a specific revisions as somehow special.
> svn cp -r 2 file:///my/repos/hack/trunk
file:///my/repos/hack/tags/stable-v1
26. Benefits
Unlimited undo!
Collaborate with others!
Enforces structured development
Makes you document what you are doing
Automatic changelog!
Helps you organize your mess in $HOME
27. Further reading
Tutorial
http://artis.imag.fr/~Xavier.Decoret/resources/svn/
Documentation (A good intro is in Chapter 2)
http://svnbook.red-bean.com/nightly/en/
Online help
> svn help
> svn [command] help