Skip to content
This repository was archived by the owner on Jul 3, 2025. It is now read-only.
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions .vscode/settings.json
Original file line number Diff line number Diff line change
Expand Up @@ -22,4 +22,7 @@
"editor.defaultFormatter": "esbenp.prettier-vscode",
"editor.formatOnSave": true,
},
"[markdown]": {
"editor.defaultFormatter": "esbenp.prettier-vscode"
},
}
14 changes: 14 additions & 0 deletions docs/stylesheets/extra.css
Original file line number Diff line number Diff line change
Expand Up @@ -32,4 +32,18 @@
/* hover effect for navigation */
.md-nav__link:hover {
text-decoration: underline;
}

/* Add vertical lines to tables */
.md-typeset table:not([class]) {
border-collapse: collapse;
}

.md-typeset table:not([class]) th {
border: 1px solid var(--md-typeset-table-color);
border-bottom: 1px solid var(--md-typeset-table-color);
}

.md-typeset table:not([class]) td {
border: 1px solid var(--md-typeset-table-color);
}
109 changes: 108 additions & 1 deletion docs/tutorial/basics/version-control.md
Original file line number Diff line number Diff line change
@@ -1 +1,108 @@
## What is Version Control ?
# :material-xml: Version Control System

---

## :material-book-open-page-variant: Understanding Version Control System (VCS)

Version Control Systems are essential tools for developers, enabling them to manage changes to source code over time. Whether you're working solo or with a team, VCS helps you track history, collaborate efficiently, and avoid costly mistakes.

## :material-brain: What is a Version Control System?

Version Control Systems are essential tools for developers, enabling them to manage changes to source code over time. Whether you're working solo or with a team, VCS helps you track history, collaborate efficiently, and avoid costly mistakes.

### :material-creation: Key Features

- Tracks changes and revisions
- Allows collaboration
- Restores previous versions
- Branches and merges code
- Keeps a full history of development

---

## :material-toolbox: Types of Version Control Systems

| Type | Description | Example Tools |
| ---------------------- | ------------------------------------------------------------------------- | ----------------------------- |
| Local VCS | Stores version history in the local system only | RCS (Revision Control System) |
| Centralized VCS (CVCS) | All versions are stored in a central server. Needs constant connectivity. | SVN, CVS |
| Distributed VCS (DVCS) | Every developer has a full copy of the repository, allowing offline work. | Git, Mercurial |

:material-check: **Git** falls under Distributed VCS, which gives it speed, flexibility, and power.

---

## :material-lightbulb: Why Use a Version Control System?

Here are some reasons why VCS is essential for any development workflow:

### Benefits

1. :material-sync: **Track Changes** – Know who changed what and when.
2. :material-wrench: **Revert Mistakes** – Easily undo errors by switching to previous versions.
3. :material-account-group: **Collaboration** – Multiple people can work on the same project without overwriting each other's code.
4. :material-source-branch: **Branching and Merging** – Experiment with features without affecting the main codebase.
5. :material-file-document: **Documentation of Changes** – Every commit has a message explaining the change.

---

## :material-sync: How Does a Version Control System Work?

VCS works by monitoring the changes in your files. Here's a simplified view of how VCS operates:

| Step | Action | Description |
| ---- | --------------------- | --------------------------------------------------------- |
| 1 | Modify Files | Edit, delete, or add files in your project. |
| 2 | Stage Changes | Add selected files to a staging area (in Git: `git add`). |
| 3 | Commit Changes | Save a snapshot of staged changes (in Git: `git commit`). |
| 4 | Push to Remote (DVCS) | Send commits to remote repository (e.g., GitHub). |
| 5 | Pull Latest Changes | Fetch updates from the remote repo to stay up-to-date. |

---

## :material-git: Git: The Most Popular VCS

Git is a free and open-source DVCS created by Linus Torvalds in 2005.

## :material-magnify: Key Git Concepts:

| Concept | Description |
| ---------- | ------------------------------------------------------------------------ |
| Repository | A directory where your project lives and Git tracks it |
| Commit | A snapshot of your project at a point in time |
| Branch | A parallel version of the repository. Used for new features or bug fixes |
| Merge | Combines changes from different branches |
| Clone | Copies an existing repo to your local machine |
| Push/Pull | Push = Upload commits; Pull = Download changes |

---

## :material-pin: Real-Life Analogy

> Think of VCS like Google Docs version history. You can see who edited the file, restore previous versions, and collaborate in real-time. Git does this, but for code, and it's way more powerful.

---

## :material-chart-line: Centralized vs Distributed – Quick Comparison

| Feature | Centralized VCS | Distributed VCS (Git) |
| ----------------- | ------------------------ | ------------------------- |
| Server Dependency | High | Low |
| Work Offline | No | Yes |
| Speed | Slower | Faster |
| Risk of Data Loss | High (if server crashes) | Low (everyone has a copy) |
| Collaboration | Limited | Seamless |

---

## :material-check-all: Summary Checklist

:material-check: Version Control is essential for tracking and managing code

:material-check: Git is the most popular and powerful DVCS

:material-check: Helps teams collaborate and experiment safely

:material-check: Supports history, branches, merging, and backups

---