What is Git and how does distributed version control differ from centralized version control?
Learn what Git is and how distributed version control differs from centralized systems, giving every developer full offline history and no single failure point.
Expected Interview Answer
Git is a distributed version control system where every developer clones a full copy of the repository — including its entire history — instead of relying on a single central server that holds the only complete copy.
In a centralized system like SVN, there is one authoritative server; clients check out working files but the history lives only on that server, so you must be online to commit or view history. In Git, each clone is a complete repository, so commits, branches, diffs, and history browsing all happen locally, and you sync with others by pushing and pulling. This makes Git faster, resilient to server outages, and friendly to branching and offline work.
- Full history available locally on every clone
- Commit and branch offline without a server
- No single point of failure
- Fast operations because they run locally
- Cheap branching and merging enable parallel work
AI Mentor Explanation
A centralized system is like one official scorer at the ground keeping the only scorebook — nobody else can record a ball until they reach that book. Git is like every player and coach carrying a full copy of the entire match history in their own pocket. Anyone can jot down deliveries independently, then reconcile their notes with the team later, so play never stops when the head scorer steps away.
Step-by-Step Explanation
Step 1
Clone the repository
git clone copies the full project including its entire commit history onto your machine, not just the latest files.
Step 2
Work locally
You commit, branch, diff, and view history entirely on your local copy with no server round-trips.
Step 3
Stage and commit
git add stages changes and git commit records them into your local history immediately, even offline.
Step 4
Sync with remotes
git push sends your commits to a shared remote; git pull brings others' commits down and integrates them.
Step 5
Resolve and share
Merge or rebase collaborators' work, resolve any conflicts locally, then push the reconciled history back.
What Interviewer Expects
- Clear definition of Git as a DVCS
- Understanding that every clone holds full history
- Contrast with centralized systems like SVN or CVS
- Awareness of offline and local operations
- Mention of push/pull as the sync mechanism
Common Mistakes
- Calling Git a centralized system or confusing it with GitHub
- Thinking a clone only downloads the latest snapshot
- Believing you must be online to commit
- Confusing the version control model with the hosting service
Best Answer (HR Friendly)
“Git is a tool that tracks changes to code so teams can work together without overwriting each other. Unlike older systems that keep everything on one central server, Git gives every developer a full copy of the project history on their own computer, so they can work offline and there is no single point of failure.”
Code Example
# Clone a full copy of the repo, including all history
git clone https://github.com/user/project.git
cd project
# Commit locally even with no network connection
git add index.js
git commit -m "Add feature"
# Sync with the shared remote when ready
git pull origin main
git push origin mainFollow-up Questions
- What is the difference between Git and GitHub?
- How does Git store history internally as snapshots versus deltas?
- What are the working directory, staging area, and repository?
- Why is branching considered cheap in Git?
- What happens if the central remote server goes down?
MCQ Practice
1. In a distributed version control system like Git, where is the full project history stored?
Each clone in Git is a complete repository that contains the entire commit history, not just the latest files.
2. Which statement about centralized version control is correct?
Centralized systems rely on one central server that holds the authoritative history, so clients typically need it online to commit or view history.
3. Which pair of commands is used to synchronize local Git commits with a shared remote?
git push sends local commits to the remote and git pull fetches and integrates remote commits into your local branch.
Flash Cards
What kind of version control system is Git? — Distributed — every clone is a full repository with complete history.
Where does a centralized VCS keep the authoritative history? — On a single central server that clients depend on.
Can you commit in Git without a network connection? — Yes — commits are recorded to your local repository and pushed to remotes later.
How do Git users share work? — By pushing commits to and pulling commits from shared remotes.