git is a Fast Distributed Version Control System (DVCS).
I wish I understood git better, but in spite of your help, I still don't have a proper understanding, so this may take a while.
-- Brian Kernighan, Awk Unicode announcement {2022 05 25}
Git is a distributed version control system created by Linus Torvalds over the course of a few weeks for developing the Linux kernel after Larry McVoy revoked the custom license for BitKeeper for the project in response to an attempt by Andrew Tridgell to reverse-engineer the BitKeeper network protocols. It uses the filesystem as its database, and outperforms every other distributed version control system in terms of speed.
In git, a branch is named a sequence change sets. Each change set is represented by a commit object that references the parent commit(s) and a tree object that describes the data in the directory hierarchy.
proc commit {} { upvar #0 $::current_branch current set current [list commit $::current_tree $current] }
Each object is referenced by its sha1 hash. Thus, even if two different commit objects reference the same tree, that tree object is only store once. Since tree object is recursive, and each subtree is itself a tree object, each subtree is only stored once, even if it is part of multiple trees.
Git does not use reference counting to reclaim orphaned objects. Instead git-gc, the garbage collector git-gc deletes them when it is run. Until then, any object that has been deleted can be reclaimed.
[PYK} {2023 08 08}: Stashing changes one one branch, switching to another, and then applying the stashed changes may produce corrupt results if checkout that the stash was created under has not been merged into the branch that the stash is applied to. Therefore, only attempt to apply a stash on a branch that has merged the branch associated with the stash. Takeway: Git sort of sucks.
Zarutian 2007-07-16: Can git be obtained or compiled into a multiplatform starkit? Hard when one has only an thumbdrive/ipod to store stuff.
Lars H 2008-06-05: Since it's a Unixy collection of many programs that do one thing each, I suspect this would be tricky (can't exec something in a vfs, can you?). Apparently there has been some work [L1 ] on turning it into a library, but that only got part of the way.
Makes me wonder, though… Could there be a semi-automatic way of turning a suite of C programs (like git, or at least the git plumbing) into a loadable extension which exposes each program as a Tcl command? (I expect one would have to do things like turning static C variables into fields of some dynamically allocated struct, to ensure reentrancy, but C is not my forte.)
FWIW, I later noticed that git has a concept of builtin command, with something rather close to a Tcl_CmdProc for every built-in subcommand of git. Probably not too hard to wrap manually, provided the built-in commands don't try to exec each other.
A thing that seems to be special about git is that it tracks content (e.g. procedure definitions) rather than files (as CVS, SVN, and Mercurial does). See A look back: Bram Cohen vs Linus Torvalds .