1. What is Version Control?
What is it?
Version Control is a system used to track and manage changes to files or source code over time.
It keeps the history of changes so developers can see what changed, who changed it, and restore an older version when required.
Why do we need it?
- Track code changes.
- Maintain version history.
- Allow multiple developers to collaborate.
- Restore previous versions.
- Identify who made a change.
Simple Example
Version 1 → Login created
Version 2 → Validation added
Version 3 → Bug fixed
If Version 3 causes a problem, we can compare it with or restore an earlier version.
Types
Version Control
├── Centralized VCS → SVN, TFVC
└── Distributed VCS → Git
Interview Answer
Version Control is a system used to track and manage changes to source code over time. It maintains change history, supports team collaboration, and allows us to restore previous versions when required.
2. What is a Distributed Version Control System?
What is it?
A Distributed Version Control System (DVCS) is a version control system where each developer has a local copy of the repository, including its history.
Git is a DVCS.
How does it work?
Remote Repository
GitHub / Azure Repos
↓ ↑
Clone/Push
↓ ↑
Local Repository
↓
Developer
Developers can perform many Git operations locally and later push their commits to the remote repository.
Example Commands
git clone <repository-url>
git add .
git commit -m "Added login"
git push origin main
Advantages
- Developers can work offline.
- Local commits are fast.
- Every developer has repository history locally.
- Good support for branching and merging.
- Easy collaboration through remote repositories.
DVCS vs Centralized VCS
| Centralized | Distributed |
|---|---|
| Central server is primary repository | Developers have local repositories |
| SVN, TFVC | Git |
| More server-dependent | Many operations work locally |
Interview Answer
A Distributed Version Control System gives each developer a local copy of the repository and its history. Developers can commit and manage changes locally and later synchronize them with a remote repository. Git is the most commonly used DVCS.