3. HOW DOES GIT STORE
INFORMATION?
At its core, git is like a key value store.
The Value (BLOB) = Data
The Key (SHA1) = Hash of the Data
4. WHERE DOES GIT STORE
ITS DATA?
blobs are stored in objects
filenames & directory structures are stored in tree
commit points to a tree & contains metadata like
author, date, message & parent commit.
references points to commits; tags, branches, head.
.git directory contains data about our repository
5. Optimisations:
PACKFILES, DELTAS
Git objects are compressed, further optimises by
compressing these files together, into a Packfile.
The Packfile stores the object, and deltas, or the
differences between one version of the file and the
next.
Packfiles are generated when: you have too
many objects, during gc, or during a push to a
remote
7. Three Areas Where Code
Lives
The Working Area
The Staging Area (a.k.a Index, Cache)
The Repository
Working
Area
Staging
Area
Repo
8. Moving In/Out of
Staging Area
add a file to the next commit
delete a file in the next
commit
rename a file in next commit
add content interactively
unstage files
Working
Area
Staging
Area
git add
git checkout
9. Moving content around..
9
commit the staged
snapshot
commit a snapshot from
working area to repo
bringing content from
repo to working area
10. The command line is the only
place you can run all Git
commands – most of the GUIs
implement only a partial subset of
Git functionality for simplicity.
10
11. Initialising a new repository: git init
Cloning an existing repository: git clone
Saving changes to the repository: git add and git commit
Inspecting a repository: git status, git log
Repo-to-repo collaboration: git remote, git fetch, git pull,
git push
Switching between: git branch, git checkout
Moving content across: git stash, git merge, git rebase, git
cherry-pick
Configuration & set up: git config