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

前端 未结 16 1362
后悔当初
后悔当初 2020-11-22 11:51

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 year

相关标签:
16条回答
  • 2020-11-22 12:11

    I think that some of the confusion comes from the difference between the concept of a tag and the implementation in SVN. To SVN a tag is a branch which is a copy. Modifying tags is considered wrong and in fact tools like TortoiseSVN will warn you if you attempt to modify anything with ../tags/.. in the path.

    0 讨论(0)
  • 2020-11-22 12:13

    In SVN a tag and branch are really similar.

    Tag = a defined slice in time, usually used for releases

    Branch = also a defined slice in time that development can continue on, usually used for major version like 1.0, 1.5, 2.0, etc, then when you release you tag the branch. This allows you to continue to support a production release while moving forward with breaking changes in the trunk

    Trunk = development work space, this is where all development should happen, and then changes merged back from branch releases.

    0 讨论(0)
  • 2020-11-22 12:17

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

    • Trunk would be the main body of development, originating from the start of the project until the present.

    • Branch will be a copy of code derived from a certain point in the trunk that is used for applying major changes to the code while preserving the integrity of the code in the trunk. If the major changes work according to plan, they are usually merged back into the trunk.

    • Tag will be a point in time on the trunk or a branch that you wish to preserve. The two main reasons for preservation would be that either this is a major release of the software, whether alpha, beta, RC or RTM, or this is the most stable point of the software before major revisions on the trunk were applied.

    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.

    0 讨论(0)
  • 2020-11-22 12:17

    Trunk : After the completion of every sprint in agile we come out with a partially shippable product. These releases are kept in trunk.

    Branches : All parallel developments codes for each ongoing sprint are kept in branches.

    Tags : Every time we release a partially shippable product kind of beta version, we make a tag for it. This gives us the code that was available at that point of time, allowing us to go back at that state if required at some point during development.

    0 讨论(0)
  • 2020-11-22 12:19

    They don't really have any formal meaning. A folder is a folder to SVN. They are a generally accepted way to organize your project.

    • The trunk is where you keep your main line of developmemt. The branch folder is where you might create, well, branches, which are hard to explain in a short post.

    • A branch is a copy of a subset of your project that you work on separately from the trunk. Maybe it's for experiments that might not go anywhere, or maybe it's for the next release, which you will later merge back into the trunk when it becomes stable.

    • And the tags folder is for creating tagged copies of your repository, usually at release checkpoints.

    But like I said, to SVN, a folder is a folder. branch, trunk and tag are just a convention.

    I'm using the word 'copy' liberally. SVN doesn't actually make full copies of things in the repository.

    0 讨论(0)
  • 2020-11-22 12:19

    For people familiar with GIT, master in GIT is equivalent to trunk in SVN.

    Branch and tag has same terminology in both GIT and SVN.

    0 讨论(0)
提交回复
热议问题