Skip to content

Instantly share code, notes, and snippets.

@masak
Last active December 20, 2015 07:39
Show Gist options
  • Save masak/6095445 to your computer and use it in GitHub Desktop.
Save masak/6095445 to your computer and use it in GitHub Desktop.
Four commands working on the index

See commit 6ad6d3d36c5924c8ff502ebbb6a6216df01e7efb in git.git for an update to the README file about these four commands.

+--------------+   update-cache   +--------------+  write-tree   +-----------+
|              | ---------------> |              | ------------> |           |
| working copy |                  | staging area |               | object db |
|              | <--------------- |              | <------------ |           |
+--------------+  checkout-cache  +--------------+   read-tree   +-----------+

(update-cache and checkout-cache were later renamed to *-index.)

In some sense, three of these are exposed through porcelain commands:

plumbing         porcelain
========         =========

update-cache     add, rm

write-tree       commit

checkout-cache   checkout

read-tree        reset

Though that's not 100% accurate, because after doing write-tree, commit also does commit-tree, thus creating the commit object itself, replete with parents and commit comment and whatnot.

Note also that both commit and reset also update HEAD.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment