Git internals, in a nutshell:

.git/objects contains a bunch of files named for their sha-1 hash, these are objects.

An object can be a blob, tree, commit, annotated tags, or arbitrary user data.

A blob is a file.

A tree is a list of files, their unix file mode, and other trees.

A commit has a list of parent commits, a date, author, commit message, and a tree ID.

An annotated tag has a commit ID and a message.

References are files in .git/refs, whose contents are a commit ID. Example references include branches (.refs/heads), tags (.refs/tags), and remote branches (.refs/remotes).

Remotes are stored in .git/config, as well as any relationships between remote branches and local branches.

Follow

@sir What happens when there is a SHA-1 collision in the objects directory (shattered.io/)?

Sign in to participate in the conversation
OCF Mastodon

A social hub for UC Berkeley students, faculty, and staff, hosted by the OCF. The OCF is a student group acting independently of the University of California.