Centralized vs Distributed Version Control
What is the difference?
| Centralized VCS (CVCS) | Distributed VCS (DVCS) |
|---|---|
| Has a central repository/server | Every developer has a local repository |
| Developers depend more on the central server | Developers can work locally/offline |
| Commit typically goes to central repository | Commit is stored locally first |
| Server failure can significantly affect work | Local repositories provide additional copies |
| Examples: SVN, TFVC | Example: Git |
Simple Flow
Centralized:
Developer A ──→ Central Repository ←── Developer B
Distributed:
Developer A Local Repo
↕
Remote Repository
↕
Developer B Local Repo
Practical Git Example
With Git:
git add .
git commit -m "Added login" # Local repository
git push origin main # Remote repository
The important point is that commit is local. push synchronizes those commits with the remote repository.
Key Points
- CVCS → Central repository is the main source.
- DVCS → Each developer has a local repository/history.
- Git is distributed.
- GitHub/Azure Repos commonly act as remote repositories for Git.
Interview Answer
In centralized version control, developers mainly work with a central repository and depend on the central server. In distributed version control, each developer has a local copy of the repository and its history. Git is a distributed version control system, so developers can commit locally and later push changes to a remote repository.