Git Glossary

A glossary of terms commonly thrown around in Git documentation. See the official Git Glossary for more (or type man gitglossary in the terminal).

Ancestor cf. Descendant A commit that came before the current commit and lies on the same lineage. Being on the same lineage means there is a path in the commit graph that connects the two commits. In other words, a parent, or a grandparent, or a great-grandparent, or... an ancestor!

Dangling A dangling commit is created when you delete a branch that is not an ancestor of any other head. (Once you delete the branch ref, there’s no way to get a ref to that commit. It is literally unreferenced, in exactly the same way as an object in a programming language.)

Descendant cf. Ancestor A commit that came after the current commit and lies on the same lineage. Being on the same lineage means there is a path in the commit graph that connects the two commits. In other words, a child, or a grandchild, or a great-grandchild, or... a descendant!

Fast-Forward In a fast-forward merge, there is a straight line between you and the branch you’re merging, so you can just move straight there; no merging necessary. In other words, you’ve made no changes to yourself in the meantime since the branch was started.

HEAD A special ref which points to where your current working copy was checked out from.

Index cf. Working Copy This refers to an intermediate staging area which resides between your repository and the files on your hard drive. Files in here are saved snapshots in the database which have not yet been packaged up into a commit. Therefore these files can be different from the ones in your working copy.

Master The main branch. Analogous to Subversion's trunk.

Origin See Remote.

Rebase This is essentially a merge without the annoying merge commit. This is how SVN always works! I still can't figure out whether rebase is something that everyone should use all the time or that advanced users should use for special situations.

Ref A reference to a single commit. This is a pointer. If you think of the commit history like a graph, then this points to a single node in that graph. It could be a tag, or it could be the tip of a branch, or it could be HEAD, the current state of your repository.

In actual fact, a branch is simply a pointer and nothing more. The actual tree structure that represents the "branch" is the commit graph, and the branch itself is just a pointer into that graph. Each repository has its own set of refs which are not necessarily shared with other repositories.

Remote Any repository which you pull changes from or push changes to. In most setups, you have just one remote called origin. origin is the central repository that lives on a server somewhere and allows you to collaborate with others.

Tip The last commit on a branch, i.e. the most recent commit, is referred to as the tip of that branch, or sometimes the head. This is a leaf in the commit graph, if you like to think in terms of graphs.

Tracking A branch will typically track another branch. The branch it tracks is referred to as its tracking or upstream branch. The upstream determines where changes are pulled from when you run git pull.

It is possible to have a temporary branch which only exists on your machine for a short time before being merged back into master. However, it is much more likely that you want to back this up in the central repository and possibly share the branch with others. Therefore it is typical for a local branch to track a remote branch of the same name.

Tree-ish The term tree-ish refers to a tree of files. Everything in Git is a tree of file objects. A commit is a tree of the files at a given point in time. See this diagram. A commit itself is a tree, but it also has parent commits, so a tree-ish (or a commit-ish) could be a collection of commits as well.

Basically, whenever you see the term tree-ish in documentation, this tells you that the command can accept a commit, tag, reference, directory, or file.

Upstream See Tracking.

Working Copy (also Working Tree) cf. Index This refers to the actual files on your hard drive. The copy you are currently working with. When you edit files, changes appear here first, and are later stored in the repository by a commit.

Comments are closed.