Controlling versions of text files (code, configuration, static data, etc.) is a crucial facet of Continuous Delivery. Version control provides traceability, predictability, and repeatability, because we’re forced to treat the version control system as the definitive source of truth. Version control is also a central communication mechanism between teams and team members, indicating the intent and purpose of our changes so that people can make better decisions.
Some important principles for version control in a Continuous Delivery context are:
Commits to version control should be cohesive and meaningful, helping people to see why a change was made.
Commits should happen many times per day—if your version control system or practices work against multiple daily commits, you’re likely using the wrong approach.
Branch as little as possible (see “Branching Options”)—use techniques such as feature toggles to manage partially completed work. Focus on completing a small number of changes rather than tackling many things in parallel.
Any non-trunk branches should be short-lived—especially feature branches.
Furthermore, for Continuous Delivery, we tend to prefer many smaller repositories to one large repository, using package management to bring together dependent modules (see “Use NuGet to Manage Internal Dependencies”).