Creation and management of Branches/Tags

One of the fundamental features of version control systems is the ability to create a new line of development from the main one. This new line of development will always share a common history with the main line if you look far enough back in time. This line is known as a branch. Branches are mostly used to try out features or fixes. When the feature or fix is finished, the branch can be merged back into the main branch (trunk).

Another feature of version control systems is the ability to take a snapshot of a particular revision, so you can at any time recreate a certain build or environment. This is known as tagging. Tagging is especially useful when making release versions.

In Subversion there is no difference between a tag and a branch. On the repository both are ordinary directories that are created by copying. The trick is that they are cheap copies instead of physical copies. Cheap copies are similar to hard links in Unix, which means that they merely link to a specific tree and revision without making a physical copy. As a result branches and tags occupy little space on the repository and are created very quickly.

As long as nobody ever commits to the directory in question, it remains a tag. If people start committing to it, it becomes a branch.

Create a Branch/Tag

In the Working Copy view, select the resource which you want to copy to a branch or tag, then select the command Branch/Tag....

Figure 3.34. The Branch/Tag dialog

The Branch/Tag dialog


The default target URL for the new branch/tag will be the repository URL of the selected resource from your working copy. You will need to change that URL to the new path for your branch/tag. To do this, click on the Browse button and choose a repository target directory for your resource.

Figure 3.35. Repository Browser dialog

Repository Browser dialog


You can also specify the source of the copy. There are three options:

  • HEAD revision in the repository - The new branch/tag will be copied in the repository from the HEAD revision. The branch will be created very quickly as the repository will make a cheap copy.

  • Specific revision in the repository - The new branch will be copied in the repository but you can specify exactly the desired revision. This is useful for example if you forgot to make a branch/tag when you released your application. If you click on the History button on the right you can select the revision number from the History dialog. This type of branch will also be created very quickly.

  • Working copy - The new branch will be a copy of your local working copy. If you have updated some files to an older revision in your working copy, or if you have made local changes, that is exactly what goes into the copy. This involves transferring some data from your working copy back to the repository, more exactly the locally modified files.

When you are ready to create the new branch/tag, write a commit comment in the corresponding field and press the OK button.