The Version Control System (VCS) presents a core component from the DevOps cycle. Tracking anything from application codes, infrastructure, policies, and what not is part of the best practices such as IaC (infrastructure as code) and GitOps. Simply put, treat everything (if possible) as code. Therefore, introducing many upsides including: having a clean change history, immutable deployments, implementing familiar development workflows on the Ops side of the story.
Now, you can’t think of VCS without Git. Though Git is a distributed VCS, on the quite opposite side you have a centralized VCS. So, what’s the catch?!
The main difference is: centralized VCS stores the code on a central remote server only, where in a distributed VCS the code can be stored (cloned) on a local workstation as well.
Based on the server-client model. A single main server where the repositories are stored and many workstations (clients) committing changes directly to this remote location.
<CENTRAL SERVER> / | \ / | \ / | \ <CLIENT-1> <CLIENT-2> <CLIENT-3>
A basic workflow would include:
- Pulling any changes made by other developers from the central server.
- Develop and test your changes.
- Commit your changes to the remote central server, so others could pull them.
- Simple and easy to start with.
- Handles binary files better.
- The central server being single point of failure.
- Requires (internet) connectivity to the server.
- Outdated model since it doesn’t fit well with the Agile and DevOps rapid development and deployment practices.
Popular tools: Subversion, CVS (Concurrent Version System) and Perforce.
Every developer holds a local copy of the remote repository including the metadata.
<CENTRAL SERVER> / | \ / | \ / | \ <REPO> <REPO> <REPO> (local copy) | | | | | | | | | <CLIENT-1> <CLIENT-2> <CLIENT-3>
Numerous workflows. Check Git 101: branching strategies if you are interested.
- Aligns well with Agile and DevOps.
- Better performance.
- Doesn’t rely on internet connectivity.
- Flexible branching and merging strats.
- Managing many sizeable, binary files is difficult. Git LFS extension address this challenge though.
Tools: Git being the leader and the most popular distributed VCS tool in this day and age. The other is Mercurial.
To find more neat Git commands and hacks, simply browse the Git category. Feel free to leave a comment below and if you find this tutorial useful, follow our official channel on Telegram.