0
0
Gitdevops~10 mins

Distributed vs centralized version control in Git - Visual Side-by-Side Comparison

Choose your learning style9 modes available
Process Flow - Distributed vs centralized version control
Start: Developer wants to save code
Centralized VCS
Commit changes to central server
Other devs pull from central server
Distributed VCS
Commit changes locally
Push changes to shared remote
Other devs pull from shared remote or clone full repo
Shows how centralized VCS relies on one central server for commits and updates, while distributed VCS allows local commits and later syncing with others.
Execution Sample
Git
git init
# Create local repo

git commit -m "First commit"
# Commit locally

git push origin main
# Push to remote

git pull origin main
# Pull updates
Basic git commands showing local commit and syncing with remote repository.
Process Table
StepActionLocationResultNotes
1git initLocal machineLocal repository createdStart local repo, no remote yet
2git commit -m "First commit"Local machineCommit saved locallyChanges recorded only on local repo
3git push origin mainLocal to RemoteChanges sent to remote serverRemote repo updated with local commit
4git pull origin mainLocal from RemoteUpdates fetched and mergedLocal repo synced with remote
5Other dev clones repoOther dev machineFull repo copied locallyDistributed VCS allows full copy
6Other dev commits locallyOther dev machineCommit saved locallyLocal commits independent of remote
7Other dev pushes changesOther dev to RemoteRemote updated with new commitsSyncing changes with others
8Centralized VCS commitDirectly on central serverCommit saved on central serverNo local commits, all on server
9Centralized VCS updateLocal from central serverLatest changes fetchedMust be connected to central server
10Exit--No more steps, process ends
💡 Process ends after syncing commits between local and remote repositories
Status Tracker
VariableStartAfter Step 2After Step 3After Step 4After Step 5After Step 6After Step 7
Local repositoryNoneInitializedHas commitSynced with remoteCloned full repoHas new local commitSynced with remote
Remote repositoryNoneNoneHas commit from pushSame as local after pullHas full repoSame as beforeUpdated with new commits
Key Moments - 3 Insights
Why can I commit changes without internet in distributed VCS but not in centralized VCS?
In distributed VCS, commits are saved locally first (see Step 2 and Step 6), so internet is not needed. Centralized VCS requires connection to central server for every commit (Step 8).
How does syncing work differently between distributed and centralized VCS?
Distributed VCS syncs by pushing and pulling full commits between local and remote repos (Steps 3,4,7). Centralized VCS always fetches from or commits directly to central server (Steps 8,9).
What happens when another developer clones the repo in distributed VCS?
They get a full copy of the entire repository including history (Step 5), allowing them to work offline and commit locally.
Visual Quiz - 3 Questions
Test your understanding
Look at the execution table, at which step is the first local commit saved?
AStep 2
BStep 3
CStep 6
DStep 8
💡 Hint
Check the 'Result' column for 'Commit saved locally' in the first few steps.
At which step does the remote repository first get updated with new commits?
AStep 2
BStep 3
CStep 6
DStep 7
💡 Hint
Look for 'Remote updated' or 'Changes sent to remote server' in the 'Result' column.
If a developer has no internet, which action can they still perform?
APush changes to remote
BPull updates from remote
CCommit changes locally
DClone repository
💡 Hint
Refer to Steps 2 and 6 where commits are saved locally without remote interaction.
Concept Snapshot
Distributed VCS lets you commit locally and sync later with others.
Centralized VCS requires a central server for all commits and updates.
Distributed VCS clones full repo; centralized only fetches latest.
Use git commands: init, commit, push, pull to manage distributed repos.
Distributed VCS works offline; centralized needs constant connection.
Full Transcript
This visual execution compares distributed and centralized version control systems using git commands. It shows how distributed VCS allows developers to commit changes locally without internet and later push to a remote repository. Centralized VCS requires all commits to be made directly on a central server, needing constant connection. The execution table traces steps like initializing a repo, committing locally, pushing to remote, and pulling updates. Variable tracking shows the state of local and remote repositories after each step. Key moments clarify common confusions about offline commits and syncing. The quiz tests understanding of when commits happen locally or remotely and what actions require internet. The snapshot summarizes the main differences and typical git commands used.