git internals
DESCRIPTION
Git internals, what goes behind the scene.TRANSCRIPT
![Page 2: Git internals](https://reader035.vdocuments.us/reader035/viewer/2022081805/54bd15734a795927448b45b2/html5/thumbnails/2.jpg)
Objects Types
● Blobs● Trees● Commits● Tags
![Page 3: Git internals](https://reader035.vdocuments.us/reader035/viewer/2022081805/54bd15734a795927448b45b2/html5/thumbnails/3.jpg)
Blobs
● Contents of files are stored as blobs.● Two files with same content will be stored once.
● The blob looks like:
● The blob is zipped and then SHA1 to get the name:2219632881ae907adbba72cc883d05bae0028730
blob [content size]\0
File content here
![Page 4: Git internals](https://reader035.vdocuments.us/reader035/viewer/2022081805/54bd15734a795927448b45b2/html5/thumbnails/4.jpg)
Trees
● Directories correspond to trees.● A tree is a simple list of trees and blobs that the tree contains, along with the names and modes of those trees and blobs.
● The tree is zipped and then SHA1 to get the name:342f6asdg1ae907adbba72cc8095dsds0028730
tree [content size]\0
100644 blob 221963 file name
![Page 5: Git internals](https://reader035.vdocuments.us/reader035/viewer/2022081805/54bd15734a795927448b45b2/html5/thumbnails/5.jpg)
Commits
● The commit is very simple, much like the tree. It simply points to a tree and keeps an author, committer, message and any parent commits that directly preceded it.
● The commit is zipped and then SHA1 to get the name:e12f3463g1ae907adbba72cc8095dsds0028730
commit [content size]\0
tree 342f6asd
author John Smith [email protected]
committer John Smith [email protected]
commit message
![Page 6: Git internals](https://reader035.vdocuments.us/reader035/viewer/2022081805/54bd15734a795927448b45b2/html5/thumbnails/6.jpg)
Tags
● A tag is permanent shorthand name for a particular commit.
● It contains an object, type, tag, tagger and a message.
● The tag is zipped and then SHA1 to get the name:e12f3463g1533dffjf3343s2111fd453absdce18
tag [content size]\0
object e12f346
type committag name
committer John Smith [email protected]
commit message
![Page 7: Git internals](https://reader035.vdocuments.us/reader035/viewer/2022081805/54bd15734a795927448b45b2/html5/thumbnails/7.jpg)
References
● References are simple pointers to a particular commit
● A branch in Git is nothing more than a file in the .git/refs/heads/ directory that contains the SHA-1 of the most recent commit of that branch.
● They are simple pointers to a particular commit, something like a tag, but easily moveable.
![Page 8: Git internals](https://reader035.vdocuments.us/reader035/viewer/2022081805/54bd15734a795927448b45b2/html5/thumbnails/8.jpg)
Thanks!