SVN: Tagging and Branching

What are "branches" and "tags" when we're talking about SVN? A tag is simply a specially marked revision: it allows us to give a revision a friendlier name than, say, "revision 901". This is why tags are usually associated to a new release of our product. For this reason, it's common practice to create a tag each time a new version of the software is released, setting the file versions in concordance with the tag name. For instance, a normal name for a tag would be "Version 3.2.0".

On the other hand, a branch is a separate line of development, and it can be used in various scenarios. Say we need to do a major refactoring without breaking our colleagues' solution, and we need to commit along the way because work will be long and complex. So we create a branch, as a copy of the "trunk" (the main development line), and work there. When we're done, we merge our changes back into the trunk. When we do that, we say the branch is "reintegrated" into the trunk and stops existing.

Another usage of branches is isolating maintenance work. Say we release an initial version of some of our products. After that, we create a "maintenance branch" for each of them and keep working on the trunk. When our customers report bugs or request new functionality, we switch to working on the product branch and do only what our client requested and nothing else. Once we're done, we merge the branch's changes back into the trunk and go back to working on the trunk. These branches are not "reintegrated" as in the previous scenario; they exist as long as we offer support for our products.

To use these features in TortoiseSVN, just right-click the working copy and select the "Branch/Tag" option. For "Tag", selecting a revision and defining the tag name is enough. In the "Tag" case, the workflow is similar, with some extra options. Once the tag or branch is created, it is possible to use the "Switch" option to take our working copy to a specific tag or branch. It's important to remember that after switching to a tag, trying to perform a commit will trigger a warning. This is due to the fact that, by convention, tags are created and never changed again.

For more details:

Comments

Popular posts from this blog

VB.NET: Raise base class events from a derived class

Apache Kafka - I - High level architecture and concepts

Upgrading Lodash from 3.x to 4.x