SVN Branches

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

Technical explanation

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:

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.

Never mind.

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.

  1. Check out head of repository (or directory in repository you want to revert)
  2. ToroiseSVN→Merge - In “From:” set same path you used in checkout and HEAD revision
  3. In “To:” set same path as in From and revision to the revision you want to revert.
  4. Merge (or dry run first)
  5. Commit
  6. Done
1)
cheap copies