What are the purpose of trunk/branch/tags in svn? [duplicate]

我们两清 提交于 2019-12-24 02:34:00

问题


Possible Duplicate:
How to use SVN, Branch? Tag? Trunk?

I have seen several articles that describe the best svn layout to be:

  • Trunk
    • Project1
    • Project2
    • Project3
  • Branch
  • Tags

Why is this the recommended layout and what exactly are the Branch and Tags folders supposed to be used for?


回答1:


/Trunk is the base folder of your application's code. It is here that you do work on your next version / release.

/Branch is a folder that allows you to pick a moment in time and allows you to go down a different path of development than that of /Trunk. A common use of /Branch is to provide your development team with access to a current snapshot of your application as it exists in production, ie. /Branch/production-maintenance.

This 'branching' concept allows your team to build fixes/enhancements to production, without affecting the ongoing work for your next version, currently happening in /Trunk. Branches can also be mini-pieces of functionality that, in large teams, allow developers to work on atomically, and merge back into /Trunk at a point in the future.

/Tags is a folder that allows you to take snapshots of your application, and work with just those particular "builds". This allows your team flexibility, both in testing, and in finding the differences between builds. You will often find a naming convention followed in /Branch, which relates to your builds, ie. /Branch/2.0.0, /Branch/2.0.1, /Branch/3.1.0, and so on. The naming convention is up to you and your team; keep it consistent!




回答2:


In short -- branches and tags allows you to keep many versions of source code in parallel.

Typical scenario is to keep development in trunk and from time to time (i.e. with each milestone/release) create a new branch with its own name.

Main advantage of this approach is to separate new/wild development from tested/released version which should be stable and need (in ideal world) fixes only.

To copy changes (i.e. fix to bug) from branch to trunk you can use merge which merging changes from both branches (trunk is also a branch).

Additionally (in newer versions of SVN) SVN keeps history of merged changesets.

There is nice stackoverflow question about branching strategies.



来源:https://stackoverflow.com/questions/6739806/what-are-the-purpose-of-trunk-branch-tags-in-svn

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!