Several times in discussions this question is raised as when to branch and when to stay on trunk for development? There are several scenarios as when to do development on trunk and when to switch to branch. Following are the most common branching scenarios
- No Branches – Your team works only from the main source tree. In this case, you do not create branches and you do not need isolation. This scenario is generally for small or medium size teams that do not require isolation for teams or for features, and do not need the isolation for releases.
- Branch for Release – Your team creates branches to support an ongoing release. This is the next most common case where you need to create a branch to stabilize for a release. In this case, your team creates a branch before release time to stabilize the release and then merges changes from the release branch back into the main source tree after the software is released.
- Branch for Maintenance – Your team creates a branch to maintain an old build. In this case, you create a branch for your maintenance efforts, so that you do not destabilize your current production builds. You may or may not merge changes from the maintenance branch back into the main tree. For example, you might work on a quick fix for a subset of customers that you do not want to include in the main build.
- Branch for Feature – Your team creates branches based on features. In this case, you create a development branch, perform work in the development branch, and then merge back into your main source tree. You can create separate branches for work on specific features to be completed in parallel.
- Branch for Team – You branch to isolate sub-teams so they can work without being subject to breaking changes, or can work in parallel towards unique milestones.
We use Subversion (SVN) at work and though branching and merging is very easy with SVN, it still involves more work than working in the trunk. In an ideal situation I believe that the code that most developers want should be on trunk, and put the minority on the branch.