What are the purpose of trunk/branch/tags in svn? [duplicate]
P开发者_JAVA技巧ossible 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?
/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!
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.
精彩评论