One of the most controversial issues developers discuss is when to create branches and how many you should have.
Keep things simple:
Note: This rule only applies to TFVC. For git, see Do you know when to branch in git?
Beware of smart bloggers giving the wrong advice π as many smart people like creating branches... E.g. Guidance: A Branching strategy for Scrum Teams. Even Martin Fowler says there are a number of issues related to merging that lead us to try and minimise the number of branches that we work with in his article on Feature Branches.
The quintessential scenario you need to support is that emergency "Hey we have a security hole on the site and Hanselman has just tweeted it!"
In that case you need to potentially update all of your branches and perform deployment, which can be quite tiresome.
The better way is to use OctopusDeploy which relieves developers from having multiple branches because you only have to worry about building on one branch and deployment can be done automatically to multiple environments. Octopus provides more secure, feature-rich environment which makes it very easy to deploy and promote builds between environments.
β Figure: Good example - Manage deployments to multiple environments, view deployed versions
If a am working on a branch and perform sweeping renaming, and a developer working on another branch does the same β merging is nearly impossible.
This is very likely to happen on code bases that require tidying when you have developers who believe in improving code as they go (see the Boy Scout rule)
β Figure: Bad example β Creating a branch per feature leads to lots of merging (Image from paulhammant.com blog)
β Figure: Bad example β Creating a branch per Sprint has everyone working on the same code but requires at least one merge every Sprint
β Figure: Good example - Release Branching - always develop on the trunk, but create a new branch each time you release. This means that all developers are continually integrating all their code, branching is rare, but you always have access to your released version in case bug fixes or small mods are required. (Image from paulhammant.com)