What does the staging area (index) do?
BeginnerConceptGit internals: objects, refs and the index
Answer
The index is the proposed next commit. git add copies the current content of files into object storage and records their blob IDs in .git/index; git commit builds a tree from the index. It lets you commit part of your working changes with git add -p and review exactly what will be committed with git diff --staged.
More on Git internals: objects, refs and the index
What are the four object types in Git's object database?BeginnerIs Git a snapshot system or a diff system?BeginnerWhat is the SHA-1 (or SHA-256) hash of an object and how is it computed?BeginnerWhere does Git store objects on disk, and what are loose objects versus packfiles?IntermediateWhat exactly is a branch, and what does creating one cost?IntermediateWhat is HEAD?Beginner