Git - Under the Bonnet

From Training Material
Jump to navigation Jump to search


GIT under the bonnet

  • Object Database
  • SHA1
  • DAG (Directed Acyclical Graph)
  • Index

Object Types

blob

  • store file data

tree

  • ties one or more "blob" objects into a directory structure
  • a tree object can refer to other tree objects, thus creating a directory hierarchy

commit

  • ties such directory hierarchies together into a directed acyclic graph (DAG) of revisions
  • each commit contains the object name of exactly one tree (snapshot of the tree)
  • a commit refers to "parent" commit objects that describe the history of how we arrived at that directory hierarchy

tag

  • symbolically identifies and can be used to sign other objects
  • It contains
    • object name (SHA1, e.g. 232A...)
    • type of another object
    • a symbolic name (e.g. version 1.0.1)
    • optionally, a signature (PGP or GPG)


Directed Acyclic Graph (DAG)

Git-dag.png
  • Stored as a linked list
  • Uses SHA1 as references
  • One root (object without parents)
  • Multiple parents allowed
    • merge (2 parents)
    • octopus merge (3 or more)

DAG and gitk

Git-gitk.png


DAG and Git objects

Git-dag-git-o.png