Interview Prep/Git & GitHub/Git internals: objects, refs and the index

What are the three trees Git compares in `status`, `diff` and `reset`?

IntermediateConceptGit internals: objects, refs and the index
Answer

HEAD (last commit), the index (staging area) and the working tree. git diff compares working tree to index, git diff --staged compares index to HEAD, and git status shows both. reset and restore choose which of the three to overwrite, which is the cleanest mental model for undo commands.

All Git & GitHub questions Roadmap: Git & GitHub

More on Git internals: objects, refs and the index