How GitWorks Git IsNotWhatYouThink
We’re going to talk aboutthe internals ofGit.
“Porcelain” Commands gitadd ▪ gitcommit ▪ git push ▪ gitpull ▪ git branch ▪ gitcheckout ▪ git merge ▪ gitrebase ▪ … ▪
“Plumbing” Commands git cat-file ▪ git hash-object ▪ gitcount-objects ▪ … ▪
If youwant to masterGit, don’t worry about learning thecommands. Instead, learn themodel.
Git
GitIs.. …a Distributed RevisionControl System
GitIs.. …a Revision ControlSystem
GitIs.. …a Stupid Content Tracker
GitIs.. …a PersistentMap
Values andKeys Any sequence ofbytes SHA1hash
Values andKeys “ApplePie” 23991897e13e47ed0adb91a0082c31c82fe0cbe5
Every object in Git hasitsown SHA1. So, what if theycollide?
Winning theJackpot 1 chance in175.000.000
Winning theJackpot
Chances of Two SHA1sColliding
SHA1s are unique in theuniverse.
GitIs.. …a PersistentMap
GitIs.. …a Stupid Content Tracker
The ObjectDatabase ./ 1177 be4d
The ObjectDatabase 3ee7 recipes/ ./ menu.txt 1177 be4d Apple Pie 2399
The ObjectDatabase Put your recipes in this directory, one README.txt recipe per file. 3ee7 361a recipes/ apple_pie.txt ./ menu.txt 1177 be4d Apple Pie 2399
The Git ObjectModel Put your recipes in this directory, one README.txt recipe per file. 3ee7 361a recipes/ apple_pie.txt ./ menu.txt 1177 be4d Apple Pie 2399
The Git ObjectModel Put your recipes in this directory, one README.txt recipe per file. 3ee7 361a 2508 recipes/ apple_pie.txt ./ menu.txt 1177 be4d Apple Pie 2399
The Git ObjectModel Put your recipes in this directory, one README.txt recipe per file. ./ 3ee7 361a 2508 6ee0 recipes/ apple_pie.txt ./ menu.txt 1177 be4d Apple Pie 2399
The Git ObjectModel Apple Pie Cheesecake f1fe menu.txt Put your recipes in this directory, one README.txt recipe per file. ./ recipes/ 3ee7 361a 2508 6ee0 recipes/ apple_pie.txt ./ menu.txt 1177 be4d Apple Pie 2399
The Git ObjectModel Apple Pie Cheesecake mytag f1fe menu.txt Put your recipes in this directory, one README.txt recipe per file. ./ recipes/ 3ee7 361a 2508 6ee0 recipes/ apple_pie.txt ./ menu.txt 1177 be4d Apple Pie 2399
GitObjects Blobs ▪ Trees ▪ Commits ▪ AnnotatedTags ▪
What Git ReallyIs f1fe 3ee7 361a 2508 6ee0 1177 be4d 2399
GitIs.. …a Stupid Content Tracker
Recommend
More recommend