Git Reference Desk

Object Database Layer

object database, $GIT_COMMON_DIR/objects/ (file system)
<pathspec>
$GIT_COMMON_DIR/ (Repository Layout), Repository Format Version

Managing Working Trees

.git directory gitdir: --git-dir/$GIT_DIR/automatically discovered
Precious Files Design Document
tracked
present (part of sparse checkout)
not present (not part of sparse checkout)
not tracked
ignored (expendable)
trashable (ignored-and-expendable)
precious (ignored-and-not-expendable)
untracked (not tracked and not ignored) (not expendable)
$GIT_WORK_TREE/**/.gitkeep

Source Code Management Layer

SCM
pseudoref (special ref)
ref, $GIT_COMMON_DIR/refs/: name pointing to an object name/another ref, has refname and reflog
name pointing to another ref: symref (symbolic reference)
name pointing to an object name (git fetch):
branch's head, $GIT_COMMON_DIR/refs/heads/ (head ref): name pointing to tip of branch
tag, $GIT_COMMON_DIR/refs/tags/, <tag>
...
name pointing to either:
HEAD, $GIT_DIR/HEAD, HEAD: name pointing to current branch or an arbitrary commit
detached HEAD
unborn branch: caused by git init or orphan operation
...

Repository Creation and Synchronization

repository: object database + refs + meta data
<repository>: URL or name of remote , tracks remote repository
<refspec> (git fetch) (git push)
branch's remote: branch.<branch>.remote
branch's upstream branch(es): <branch's remote, branch.<branch>.merge>
branch's remote tracking branch(es): branch.<branch>.merge mapped via remote.<branch's remote>.fetch
git merge
default branch(es) to merge into current branch: (if merge.defaultToUpstream:) current branch's remote tracking branch(es)
git fetch
remote's url to fetch from: first of remote.<remote>.url
remote to fetch from: <repository>/branch.<current branch>.remote/(if only one remote:) the only remote
refs to fetch from remote (recorded in FETCH_HEAD): ((<refspec>s present:) <refspec>s^(<refspec>s absent:) remote.<remote>.fetch)/HEAD
local refs to update: refs to fetch from remote mapped via (<refspec with dst>s&((--refmap=<refspec>s present:) --refmap=<refspec>s^(--refmap=<refspec>s absent:) remote.<remote>.fetch))
git pull
git push

Snapshotting

how to publish the tree from a commit without exposing its full history, how to start a disconnected history
git notes, $GIT_COMMON_DIR/refs/notes/, $GIT_DIR/NOTES_MERGE_PARTIAL, $GIT_DIR/NOTES_MERGE_WORKTREE, $GIT_DIR/NOTES_MERGE_REF
git replace, $GIT_COMMON_DIR/refs/replace/

Checkin/Checkout Filters

text/binary per file: text/eol/core.autocrlf
line-ending style per text file: eol/core.autocrlf/core.eol
ident
filter driver, clean filter, smudge filter, process filter: filter
diffcore transformation
DB
index
working
tree
checking whitespace errors per file: whitespace/core.whitespace

Diff Driver (for user facing diff output)

Diff Filter (mark up the diff further for human consumption)

Combining Diffs

fast-forward (git merge) (git push)
merge (merge commit) (git merge)
topic branch
keep-canonical-history-correct
separating-topic-branches
git cherry

Merge Driver

merge driver per file: merge/merge.default
built-in merge drivers, how to define merge driver

Rewriting History

Miscellaneous

Examples