The git book defines the git index:
The Git index is used as a staging area between your working directory and your repository. You can use the index to build up a set of changes that you want to commit together. When you create a commit, what is committed is what is currently in the index, not what is in your working directory.
But I am still having a difficult time understanding it, especially the highlighted statement that "what's committed is not what's in my working directory".
So far, in my limited working with git, everything in the working directory is always committed, if I do:
git add <all new files in the working directory>
git commit -a -m "git will refuse to commit without this comment"
git then commits all modified files as well as all new files.
So, in effect, my working directory is the staging area?
I am not sure then what the git index
is and how it is interpreted as the staging area.
Could you please explain?