DevOps
Version Control
Introduction

Introduction to Version Control

Version Control Systems (VCS) are a category of software tools that help a software team manage changes to source code over time.

Why use Version Control?

Think of VCS as a "Time Machine" for your codebase. It keeps track of every modification to the code in a special kind of database.

  • Traceability: Know who made what change and why.
  • Collaboration: Multiple people can work on the same file simultaneously.
  • Security: Easily revert to a previous "known good" state if a bug is introduced.
  • Experimentation: Create "branches" to test new features without breaking the main code.

🛠️ Components of a VCS

To master version control, you must understand these core building blocks:

  1. Repository (Repo): The central database where all versions of your project (history) are stored.
  2. Working Copy: Your local version of the code where you make changes.
  3. Commit: A "snapshot" of your changes saved into the repository with a descriptive message.
  4. Update/Pull: Retrieving the latest changes from the repository into your working copy.
  5. Merging: Combining changes from different developers or branches.
  6. Conflict: This occurs when two developers modify the same line of a file, and the VCS cannot automatically determine which version to keep.

The Big Picture


[!TIP] Commit Often, Commit Small Small, atomic commits are much easier to understand, revert, and debug than monolithic "End of Day" commits containing hundreds of unrelated changes.