top button
Flag Notify
    Connect to us
      Facebook Login
      Site Registration Why to Join

Facebook Login
Site Registration

Explain the difference between Trunk, Branch and tags relative to Subversion Source Control System like SVN.

+1 vote
Explain the difference between Trunk, Branch and tags relative to Subversion Source Control System like SVN.
posted May 9, 2014 by Nikhil Pandey

Share this question
Facebook Share Button Twitter Share Button Google+ Share Button LinkedIn Share Button Multiple Social Share Button

1 Answer

0 votes

There are many source control systems like Git, Clearcase, Subversion (aka SVN), etc, and SVN is a very popular open source source control system. You can use it via its command line commands or via GUI based client tools like TortosieSVN.

Technically all three i.e. trunk, branch and tag are folders in SVN. If you are using tortoise SVN, a popular windows client for subversion, you can explore trunk, branch or tag. If you browse SVN repository using Repo browser or simply open it on any browser e.g. Internet explorer, you will generally see three directories as trunk, branch and tags at root of project. This is actually one of SVN best practice to create this kind of directory structure. As I said earlier, trunk is place where main development happens, and branches are places where different developer work on different functionalities. This division is purely based on how programmer uses trunk and branches. Similarly, tags are used to backup releases e.g. alpha release or beta release or any version of release. Main difference between branch and tag in subversion is that, tag is a read only copy of source code at any point and no further change on tag is accepted, while branch is mainly for development. Other source control like CVS doesn't allow modification on tags but SVN allows changes on tags, which is considered as bad practice. You should not be making any change on tag once created, it should be treated as read only copy of source code only for restore purpose.

In Short:

  • A trunk in SVN is main development area, where major development happens. Like a tree, trunk is a tree’s central superstructure. All branches come out of the trunk.
  • A branch in SVN is sub development area where parallel development on different features happens. Branches are created for adding new features/enhancements, bug fixes, and maintenance. After completion of a functionality, a branch is usually merged back into trunk. Tools like TortoiseSVN and IDE plugins for SVN simplifies the code merging task.
  • A tag in SVN is a read only copy of source code from branch or trunk at any point of time. A tag is mostly used to create a copy of released source code so that it can be rolled back.
  • A head is the latest version in the repository. That is either in the trunk or branch.

Note: That's all on difference between trunk, branch and tags in Subversion or SVN. They are mostly categorized based upon there usage. Though trunk, branch and tag are quite common words in source control, and other SCM also uses these words, there behavior may be little different on other SCM, so don't forget to check SCM documentation.

answer May 13, 2014 by Brijesh Talwar
Similar Questions
0 votes

We are using Visual SVN server in our company. It worked well, but users unable to create particular branch from trunk folder

I have put svnadmin verify to check repository and found error as below

  • Verified revision 508448.
  • Verified revision 508449.
  • Verified revision 508450.
  • Verified revision 508451.

svnadmin: E160004: Mergeinfo-count discrepancy on a-1.0.r508452/9674: expected 1244741480414057964+0, counted 116

Could you please tell me what to do

+1 vote

I have the following setup "trunk and branch A (created from trunk)"

Now, what I want to do is only commit my changes to the trunk and make sure that every committed change is replicated into branch A. This should be an automatic commit, triggered by the commit to trunk, while being aware of the fact that no other changes should be done in branch A but the autocommit from trunk.

Another "would-like" requirement is that the commit metadata like author and commit time/date are kept, but this is not a must have. Is that possible with svn, maybe with autocommit hooks? If not, what other way would you see to achieve that?

+1 vote

We want to Migrate code and revision history repository from Mercurial to subversion, Can you please provide the scripts/tools if there are any for doing this activity?

Can you please guide me for completing this activity successfully.

+1 vote

I want to upgrade my Linux box from Debian Jessie (32bit) to Debian Jessie (64bit). For the transition time, the machine will boot alternating the 32bit and the 64bit OS.

I have several SVN repositories and working copies on it. Is it safe to share SVN repositories and working copies between 32bit and 64 bit?

Contact Us
+91 9880187415
#280, 3rd floor, 5th Main
6th Sector, HSR Layout
Karnataka INDIA.