blog. feed tags

Git Commands I Use

· read · git

Git’s data model is a bunch of trees.

There’s the working tree which is the directory that you edit on-disk, the index (which I like to call the staging tree) which is a directory you can’t look at, and finally each commit is associated with its own tree. Each commit also points at its parent commit (or both, if it’s a merge commit).

When a commit is created, HEAD is updated:

A <ref> is a branch, which points at a commit.

Every <ref> is also a <commit>, which is understood as the commit that the ref is currently pointing at; and every <commit> is also a <ref>, which is understood as a reference that points at <commit> and can never change.

Here are the commands I use (for the source material, ahem more detailed documentation, Git’s man pages are great: man git-<command>):