<p>When I first started using revision control systems like <a href="http://en.wikipedia.org/wiki/Concurrent_Versions_System" rel="nofollow noreferrer">CVS</a> and <a href="http://en.wikipedia.org/wiki/Apache_Subversion" rel="nofollow noreferrer">SVN</a>, I didn't really understand the concepts of the "trunk", branching, merging and tagging. I'm now starting to understand these concepts, and really get the importance and power behind them.</p>

<p>So, I'm starting to do it properly. Or so I think... This is what I understand so far: The latest release/stable version of your code should sit in /trunk/ while beta versions or bleeding edge versions sit inside the /branches/ directory as different directories for each beta release, and then merged into the trunk when you release.</p>

<p>Is this too simplistic a view on things? What repository layouts do you guys recommend? If it makes a difference, I'm using Subversion.</p>

[{'answer_id': 17738, 'author': 'Lasse V. Karlsen', 'author_id': 267, 'author_profile': 'https://Stackoverflow.com/users/267', 'pm_score': 4, 'selected': True, 'text': '<p>See these two questions on SO for more information:</p>\n\n<ul>\n<li><a href="https://stackoverflow.com/questions/16142/what-does-branch-tag-and-trunk-really-mean">What does branch, tag and trunk really mean?</a></li>\n<li><a href="https://stackoverflow.com/questions/15621/subversion-question">Subversion question</a></li>\n</ul>\n'}, {'answer_id': 17744, 'author': 'Erick Sasse', 'author_id': 2089, 'author_profile': 'https://Stackoverflow.com/users/2089', 'pm_score': 3, 'selected': False, 'text': '<p>What I do and normally see as a standard is:</p>\n\n<p>The trunk should contain your main line of development, your unstable version.\nYou should create release branches for your releases.</p>\n\n<p>Something like:</p>\n\n<p>/trunk (here your are developing version 2.0)\n/branches/RB-1.0 (this is the release branch for 1.0)\n/branches/RB-1.5 </p>\n\n<p>When you find a bug in 1.5, you fix it in the RB branch and then merge to the trunk.</p>\n\n<p>I also recommend <a href="https://rads.stackoverflow.com/amzn/click/com/0977616657" rel="noreferrer" rel="nofollow noreferrer">this book</a>.</p>\n'}, {'answer_id': 17767, 'author': 'Ian Nelson', 'author_id': 2084, 'author_profile': 'https://Stackoverflow.com/users/2084', 'pm_score': 1, 'selected': False, 'text': '<p>Eric has an excellent series of articles on Source Control use and organisational best practices.\n<a href="http://www.ericsink.com/scm/scm_branches.html" rel="nofollow noreferrer">Chapter 7 deals with branches</a> (and yes, it recommends the /trunk/ and /branches/ directories you suggest).</p>\n'}, {'answer_id': 17782, 'author': 'Greg Whitfield', 'author_id': 2102, 'author_profile': 'https://Stackoverflow.com/users/2102', 'pm_score': 1, 'selected': False, 'text': '<p>I have used Perforce for a long time, and so my comments may be a little Perforce-centric, but the basic principles apply to any SCM software that has half decent branching.\nI\'m a very strong believer in using branched development practices. I have a "main" (aka "mainline") that represents the codebase from now to eternity. The aim is that this is, most of the time, stable and, if push came to shove, you could cut a release anytime that would reflect the current functionality of the system. Those pesky sales guys keep asking....</p>\n\n<p>Developments happen in branches that are branched from MAIN (normally - occasionally you may want to branch from an existing dev branch). Integrate from MAIN to your dev branches as often as you can, to stop things diverging too much - or you can simply budget for a bigger integration period later. Only integrate your arse kicking new feature to MAIN when you are sure that it will go out in a forthcoming release.</p>\n\n<p>Finally, you have a RELEASE line, which the option of different branches for different releases. There\'s some choices depending on the labelling capabilities of your SCM software,and how different major/minor revisions are likely to be. So you may opt, for example, for a release branch for every point release, or only for major rev number. Your mileage may vary.</p>\n\n<p>Generally, branch from MAIN to release as late as possible. Bugfixes and last minute changes can either go straight into RELEASE for later integration to MAIN, or into MAIN for immediate integration back up. There\'s no hard and fast rule - do what works best. If, however, you have changes that may be submitted to MAIN (e.g. from a dev branch, or "little tweaks" by someone on MAIN), then do the former. It depends on how your team works, what your release cycles are etc.</p>\n\n<p>E.g. I would have something like this:</p>\n\n<pre><code>//MYPROJECT/MAIN/... - the top level folder for a complete build of all the product in main.\n//MYPROJECT/DEV/ArseKickingFeature/... - a branch from MAIN where developers work.\n//MYPROJECT/RELEASE/1.0/...\n//MYPROJECT/RELEASE/2.0/...\n</code></pre>\n\n<p>A non-trivial project will probably have a number of DEV branches active at once. When a development has been integrated into MAIN so that it is now part of the core project, kill off the old DEV branch as soon as you can. Many engineers will treat a DEV branch as their own personal space, and reuse it for different features over time. Discourage this.</p>\n\n<p>If, after release, you have to fix a bug, then do that in the corresponding release branch. If the bug has been previously fixed in MAIN, then integrate across, unless the code has changed so much in MAIN the fix is different.</p>\n\n<p>What really differentiates the codelines is the policies you use to manage them. For example, what tests get run, who reviews pre/post a change, what action happens if a build breaks. Typically policies - and therefore overhead - are strongest in release branches, and weakest in DEV. There\'s an article <a href="http://www.vaccaperna.co.uk/scm/branching.html" rel="nofollow noreferrer">here</a> that goes through some scenarios, and links to other useful things.</p>\n\n<p>Finally, I recommend going with a simple structure to start with, and only introduce extra dev &amp; release ones as needed. </p>\n\n<p>Hope that helps, and is not stating-the-bleedin\'-obvious too much.</p>\n'}]
['https://Stackoverflow.com/questions/17735', 'https://Stackoverflow.com', 'https://Stackoverflow.com/users/1951/']