Table of Contents
SVN is a nice tool that can do us a lot of good, but it can also become the tool of terror and conflicts if not used properly. Please try to use svn
SVN repository does not actually use branches and tags, it uses 1) instead. Cheap copy is a more or less unix hardlink to certain revision (it saves time and space) in some other part of repository.
When you create a new branch, you will create a cheap copy and the only thing stored in new branch will be patches against the cheap copy.
How to use branches
You should create a new branch (or synchronize an old one) when you want to create a some nice feature (like map) that can not be done in single revision. If you just want to kill a bug or change name of menu, please use trunk.
Ideal world process:
- create a new branch from trunk
- spend a lot of time implementing the features
- merge my branch with trunk
- other branches can merge new feature, but it is not necessary, it is up to maintainer of branch to do it.
Remember: it has to be possible to compile trunk at any given time!
There is short nice manual about creation of branches in ToroiseSVN help (context menu of repository→ToroiseSVN→Help) chapter 5.16 and about merging in chapter 5.17. The other nice resource is chapter 4 of Subversion book.
You can switch between branches, so make sure you are editing the right one. You can always switch through context menu→ToroiseSVN→Switch and filling in the address of the branch you want to edit.
How to create a branch
If you don't want to read, you don't deserve branches. There is step-by-step guide in toroise svn help.
- Go to directory where some branch is stored (like branches/main)
- context menu → ToroiseSVN → Branch/tag..
- to “to URL” write where will your new branch will be stored (like
) for branch mapfeature
- check “Switch working copy to new branch/tag” if you want switch to new branch
If you switch between two branches with some files changed in working copy, it should work same as updating (not tested)
How to merge two branches
Same case. Even worse, since you can screw up someone else's repository. There is step-by-step guide in toroise svn help.
How to use tags
Tags are specific revisions that are tagged. You can tag revision as “Released to public as Release 0.1” and so on. Although tags are created and handled in same way as the branches, DO NOT use them as branches. SVN will give warning, but that's it.
The process of creation is same as with branch, just use /tag/mytaggedrevision.
Tags are also cheap copies = nearly no space and other stuff taken.
How to revert repository to a previous revision
Sometimes you commit something you didn't want to or the commit breaks the repository and the best option is to revert repository to the previous revision. It can probably be done some other way, but this one works.
- Check out head of repository (or directory in repository you want to revert)
- ToroiseSVN→Merge - In “From:” set same path you used in checkout and HEAD revision
- In “To:” set same path as in From and revision to the revision you want to revert.
- Merge (or dry run first)