> For the complete documentation index, see [llms.txt](https://devops-3.gitbook.io/devops/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://devops-3.gitbook.io/devops/docs/module-5-vcs/version-control-system.md).

# Version Control System

Version control, also known as source control, is the practice of tracking and managing changes to software code. Version control systems are software tools that help software teams manage changes to source code over time.

<figure><img src="https://921544542-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FiRQTWHUNVZ5tIxQJXclF%2Fuploads%2FZi4vGdPfGlN8DRF6DCKW%2FVersion-Control-System-Software-List-Examples.png?alt=media&amp;token=7ea6699b-626a-4877-a08e-53437ed7ed08" alt=""><figcaption><p>VCS Tools</p></figcaption></figure>

### Types of VCS

1. Centralized VCS

These systems have a single server that contains the versioned files, and some clients to check out files from a central place.

<figure><img src="https://921544542-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FiRQTWHUNVZ5tIxQJXclF%2Fuploads%2FTN0yClanzB0RWHde1EOE%2Fcentralized-vs-distributed-version-control-system-2_orig.jpg?alt=media&amp;token=102670a0-9c42-4d6c-a52f-20859e35d4f5" alt=""><figcaption><p>Centralized VCS</p></figcaption></figure>

2. Distributed VCS

In a Distributed Version Control System (such as Git, Mercurial, Bazaar or Darcs), the user has a local copy of a repository.&#x20;

So, the clients don't just check out the latest snapshot of the files even they can fully mirror the repository.&#x20;

The local repository contains all the files and metadata present in the main repository.

<figure><img src="https://921544542-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FiRQTWHUNVZ5tIxQJXclF%2Fuploads%2FJnIHFzQ3uifNdQ9GdXUx%2Fcentralized-vs-distributed-version-control-system-3_orig.jpg?alt=media&amp;token=9a7cd117-4c32-4471-b8aa-6fea1afdc7e0" alt=""><figcaption><p>Distributed VCS</p></figcaption></figure>

### Branches

A branch is a version of the repository that diverges from the main working project. It is a feature available in most modern version control systems.

A Git project can have more than one branch. These branches are a pointer to a snapshot of your changes.]

When you want to add a new feature or fix a bug, you spawn a new branch to summarize your changes.&#x20;

So, it is complex to merge the unstable code with the main code base and also facilitates you to clean up your future history before merging with the main branch.

<figure><img src="https://921544542-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FiRQTWHUNVZ5tIxQJXclF%2Fuploads%2FPTGUqbgwNtV9O5X185WX%2FScreenshot%202024-06-17%20182623.png?alt=media&amp;token=e4cdbbe3-6a52-4a39-80eb-c28dc3432ab3" alt=""><figcaption><p>Branch</p></figcaption></figure>

### Types of Branches

<figure><img src="https://921544542-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FiRQTWHUNVZ5tIxQJXclF%2Fuploads%2FvRk4hVg6Exl0xsX3jFop%2Fbranch1.png?alt=media&amp;token=b60081b2-2fa9-49c4-8977-e80f5ff6a345" alt=""><figcaption><p>Types of Branches</p></figcaption></figure>
