This document provides an overview of Git internals and data structures including blobs, trees, commits and refs. It demonstrates how Git objects are stored and referenced in the Git database. Various Git commands are shown such as add, commit, branch, checkout, merge, reset, rebase and reflog. The document explains the relationships between blobs, trees, commits and branches during normal workflows as well as examples of fast-forward merges, rebases and resetting.
17. objects
there are three types of objects: blobs, trees & commits
blobs represent files
blobs are created with the add, not the commit command
blobs are snapshots, not deltas or patches
the add command records snapshots every time
a file can be both “staged” and “modified”
trees represent directories
trees point to blobs and/or trees
18. refs
$ ls .git/HEAD
.git/HEAD <- important
$ tree .git/refs/
├── heads <- important
│ └── master
├── remotes
├── stash
└── tags
43. git rebase
$ git show-ref feature_branch --abbrev
3333333 refs/heads/feature_branch
$ git checkout feature_branch
$ git rebase master
First, rewinding head to replay your work on top of it...
Applying: commit msg #3
$ git show-ref feature_branch --abbrev
6666666 refs/heads/feature_branch