svnbranchterminologytrunk

What do "branch", "tag" and "trunk" mean in Subversion repositories?


I've seen these words a lot around Subversion (and I guess general repository) discussions.
I have been using SVN for my projects for the last few years, but I've never grasped the complete concept of these directories.

What do they mean?


Solution

  • Hmm, not sure I agree with Nick re tag being similar to a branch. A tag is just a marker

    In open source projects, major branches that are not accepted into the trunk by the project stakeholders can become the bases for forks -- e.g., totally separate projects that share a common origin with other source code.

    The branch and tag subtrees are distinguished from the trunk in the following ways:

    Subversion allows sysadmins to create hook scripts which are triggered for execution when certain events occur; for instance, committing a change to the repository. It is very common for a typical Subversion repository implementation to treat any path containing "/tag/" to be write-protected after creation; the net result is that tags, once created, are immutable (at least to "ordinary" users). This is done via the hook scripts, which enforce the immutability by preventing further changes if tag is a parent node of the changed object.

    Subversion also has added features, since version 1.5, relating to "branch merge tracking" so that changes committed to a branch can be merged back into the trunk with support for incremental, "smart" merging.