Git

Git is a content-addressable file system in which objects are addressed by their hash. You can insert any kind of content into a Git repository, for which Git will hand you back a unique key you can use later to retrieve that content.

Type git help [COMMAND|GUIDE] in the terminal for help information.

Git's data model

Objects

Git is a key-value data store. Content is stored as tree, blob, and commit objects.

  • tree: UNIX directory or map<string, tree | blob>
  • blob: UNIX inode (file contents) or array<byte>
  • commit:
struct commit {
  commit_message <string>
  commiter <string>
  commit_date <string>
  author <string>
  author_date <string>
  snapshot <tree>
  parents array<commit>
}

Git maintains an object as map <string, object>. Objects do not contain other objects but rather pointers as ids.

References

Key-value pairs of human readable strings and hashes.

references: map<string, string>

History

Git uses a directed acyclic modeled graph to model history. Every state points back to the state that precedes it and each snapshot contains metadata about the state. This allows for branching and merging parallel paths of development.

Commits

A commit records changes to the repository. It is a snapshot of a point in time. Each commit is assigned a unique hash.

Write good commit messages!

Configuration

gitconfig file in my dotfiles repo.

View a list of options by running man git-config.

Config resources

Config examples