Skip to content

Git

Published:

Where did Git come from?

In 2002 the Linux kernel project began using BitKeeper, a proprietary distributed version control system [1]. In 2005 the relationship between the kernel community and the company behind BitKeeper broke down, and the tool's free-of-charge status was revoked [1]. That pushed the community, Linus Torvalds in particular, to build its own tool using what it had learned from BitKeeper [1]. Git now describes itself as a free and open-source system designed to handle everything from small to very large projects with speed and efficiency [3].

How does Git store data?

Many systems store a list of file-based changes. Git instead treats its data as a series of snapshots of a miniature filesystem, and when a file has not changed it stores a link to the previous copy rather than the file again [2]. Most operations are local, because the full project history sits on your disk [2].

Everything is checksummed with SHA-1 before it is stored and is then referred to by that checksum, a 40-character hexadecimal string such as 24b9da6552252987aa493b52f8696cd6d3b00373. As a result, file contents cannot change without Git knowing [2].

What stages does a change go through?

A file in Git is in one of three states: modified, staged or committed [2]. In practice you edit a file in the working tree, stage the changes you want in the next snapshot, then commit, which stores that snapshot permanently in the Git directory [2].

Frequently asked questions

Is Git the same as GitHub?

No. Git is the version control system that runs on your machine. GitHub is a service that hosts Git repositories.

Does Git work offline?

Yes. The project history lives on your local disk, so browsing history and committing need no connection. You only need one to push changes to a server.

Sources

  1. 1.2 Getting Started - A Short History of Git — Pro Git, git-scm.com
  2. 1.3 Getting Started - What is Git? — Pro Git, git-scm.com
  3. Git — git-scm.com