What is trunk, branch and tag in Subversion?

Hemanshu Bhojak picture Hemanshu Bhojak · Mar 30, 2009 · Viewed 287.1k times · Source

Possible Duplicate:
What do “branch”, “tag” and “trunk” really mean?

What is a trunk, branch and tag in Subversion and what are the best practices to use them?

What tools can I use for Subversion in Visual Studio 2008?

Answer

David Schmitt picture David Schmitt · Mar 30, 2009

The trunk is the main line of development in a SVN repository.

A branch is a side-line of development created to make larger, experimental or disrupting work without annoying users of the trunk version. Also, branches can be used to create development lines for multiple versions of the same product, like having a place to backport bugfixes into a stable release.

Finally, tags are markers to highlight notable revisions in the history of the repository, usually things like "this was released as 1.0".

See the HTML version of "Version Control with Subversion", especially Chapter 4: Branching and Merging or buy it in paper (e.g. from amazon) for an in-depth discussion of the technical details.

As others (e.g. Peter Neubauer below) the underlying implementation as /tags /branches and /trunk directories is only conventional and not in any way enforced by the tools. Violating these conventions leads to confusion all around, as this breaks habits and expectations of others accessing the repository. Special care must be taken to avoid committing new changes into tags, which should be frozen.


I use TortoiseSVN but no Visual Studio integration. I keep the "Check for modifications" dialog open on the second monitor the whole time, so I can track which files I have touched. But see the "Best SVN Tools" question, for more recommendations.