Overview
Provide facility to track the changes over time and keep the history of every file We can rollback the changes if anything goes wrong
The source control system is tailored for source code
Source Control is a fundamental enabler of continuous delivery because it provides us with a system where we can work in isolation where we can roll back to a known good state and because we can trust source control system to be the starting point that provides the single source of truth if it comes to getting the source code to build our runtime artifacts
It also starting point if continued delivery
.
Type of source control systems
Centralized and distributed
Centralized:-
In a centralized source control system, users access a master copy via a client typically their local machine will then hold a working copy of the project tree
Changes in a working copy must be committed to the master repository before they are propagated to other users
Distributed:-
In distributed model repositories act as a pier and users typically have a local repository with version history available in addition to their working copies.
Centralized and distributed source control system Strengths and Use cases
Strengths of the centralized source control system and use case
They are very capable of handling very lard codebases, Microsoft itself using this system for a decade
In centralized SCS you can set very fine-grained permission levels since you need to get every file from the server you can control the permission on each file that comes from the server
You can also easily monitor the usage of the repository and that gives you insights into who’s changing what and why
If there are files that are hard to merge you can also apply the notion of exclusive locking meaning nobody else can work with that file until the other has released the lock
This can prevent you from very nasty merge scenarios
So centralized source control system is best used when you have a very large codebase when you want fine-grained control over who can access which file in the system, and when you have file types that are hard to merge
Strengths and use cases of Distributed version control
We have seen there is big shift toward distributed SCS, now when you say distributed version control system then there will be git or mercurial for the same
The distributed source control system offers a complete offline experience your branch and merges locally you can rollback and you can do more or less any operation you want because it’s all done locally on your machine
Because you work locally. You will see that all operations are done extremely fast, which is by the way important reason people like distributed version control system
Not only you can work locally you can also have the full history of the source with you so you can do a local lookup who made changes to the code a month ago without the need of connecting to a server
Cross-platform support is great for distributed source control system
Almost any non-windows system comes out of the box with git tools installed
When you use a tool like visual studio then git will also able be installed to go with it since git is less the source control system of choice
One thing that’s really great, but git specific is the ability to use a so-called pull request A pull request contains changes you would like to merge into another repository or branch
The pull request contains meta information and the option to go back and forth on the code review before you merge or decline, pull request are used heavily these days and provided you an easy way to get compliance in your system, if you guard your branch or repository with a pull request then you always have an extra pair of eyes before the code, is committed to the repository that gives you at least a four-eyes principle which is an important concept if it comes to mitigating risks.