When add
is executed, Git updates the index using the current content found in the working tree (staging your changes), and prepares the content staged for the next commit, which involves the following steps:
Computing the hash for the content.
Deciding whether to create new content, or link to an existing blob object.
Actual creation or linking of blob takes place.
Creation of a tree object to track location of the content.
At this point the index is said to hold a snapshot of the content in the working tree for the next commit.
As you already know, this command can be performed multiple times before a commit. It only adds the content of the specified file(s) at the time the add
command is run; if you want subsequent changes included in the next commit, you must run git add
again to add the new content to the index.