| Concept | SVN | Git |
|---|---|---|
| Repository | Central server database | Local .git folder (full clone) |
| Get the repo | svn checkout URL | git clone URL (gets full history) |
| Commit | Network upload to server | Local snapshot save |
| Publish | (same as commit) | git push (separate step) |
| Revision ID | r1024 (sequential integer) | a1b2c3d (SHA-1 hash) |
| Branch | Directory copy, O(N) | Pointer creation, O(1) |
| Get changes | svn update | git fetch + git merge (or git pull) |
| View history | svn log | git log --oneline --graph --decorate |
| Undo local edits | svn revert FILE | git restore FILE (not git revert!) |
| Undo a commit | (no equivalent) | git revert COMMIT (new “reverse” commit) |
| Switch branch | svn switch BRANCH | git switch BRANCH |
| Who wrote this? | svn blame FILE | git blame FILE |
Reference slide. Press Down for more, Right to continue
main points to D; topic points to Fmain (that is where we are working)This is the typical state before a merge.
After git clone, your machine has its own DAG. The remote “origin” has its own.
origin/main is a local pointer, not a live linkgit status says “up to date” — it compares locally only, does NOT contact the servergit fetch / git pull actually talks to the remotegit status can say
“up to date” even when the remote is 50 commits ahead.
Run git fetch first if you want the truth.
Press Down for a step-by-step example of the push/pull cycle.
After clone: both machines are identical. Everything is in sync.
main and origin/main both point to C. You and the remote agree.
Press Down to continue, Right to skip ahead
Your colleague commits and pushes D. The remote moves forward.
Your machine has no idea that D exists.
origin/main still points to C — that is where the remote was when you last fetched.
Press Down to continue, Right to skip ahead
You commit E locally. git status says “ahead of origin/main by 1 commit.”
The two graphs have diverged, but you do not know it yet.
git status thinks you are simply 1 commit ahead — it has no idea the remote also moved.
Press Down to continue, Right to skip ahead
git fetch downloads D and updates origin/main. Your files are untouched.
Now you can see the divergence. main is at E, origin/main is at D.
Press Down to continue, Right to skip ahead
git pull merges D and E into a new merge commit M.
M has two parents (D and E). Your work and your colleague’s work are combined.
Press Down to continue, Right to skip ahead
git push succeeds. Both machines are back in sync.
main and origin/main both point to M. Everyone has everything.
Reference slide. Press Right to continue
Remote “origin”:
Your local repo after fetch:
After git merge origin/main (or git pull):
origin/main updates only on fetch (or pull, which fetches first)origin/maingit branch -vv shows tracking relationshipsReference slide
Fast-forward (topic is ahead of main, no divergence):
Before:
After:
No new commit is created. main pointer simply moves forward.
Merge commit (main and topic have diverged):
Before:
After:
M is a new commit with two parents.
Reference slide
Two outcomes when you run git merge topic:
Fast-forward (no divergence): main pointer moves to the topic commit. No new commit created.
Merge commit (branches diverged): a new commit with two parents is created.
svn merge (which replays changes one at a time),
Git merge combines two snapshots into one. The result is a new commit with two parents.