Git

From HaskellWiki
Revision as of 20:46, 6 September 2012 by Aristid (talk | contribs) (packfile motivation?)
Jump to navigation Jump to search

WORK IN PROGRESS

This page aims to introduce the concepts behind Git in a "Haskell way".

The DAG

TODO

Branches and tags

TODO

Objects

Kinds of objects

TODO

The object store

All the different objects in Git - individual files, entire directory trees, commits and other things - are stored in a repository-wide central store. Each object is identified by computing a SHA-1 hash, which is a function of only the object's contents.

But... doesn't that mean that when I change a single line in a file, a whole new copy is stored?

Yes.

However, every once in a while, git compacts files that are similar together into Packfiles, by storing only their diffs. [TO BE EXPANDED?]

Garbage collection and git reflog

When objects are not reachable from any root (like a branch reference), they become dangling and are subject to garbage collection. However, garbage collection does not kick in immediately.

When making a mistake, it is often helpful to look at commit objects by date independent of whether they are reachable, in order to be able to restore them. You can use git reflog for that.