The Git index is where files are staged for commits; take a look at this StackOverflow answer for more information. When you stage files for commit, the index reflects the latest staged information. Staging a file a second time will change the Git index to reflect the file's content in the working directory.
However, with some additional work, you can see the content of the file as it was for each stage. You can use git ls-files
after each stage to get a list of file blobs that you can then use later for comparison using diff
or some other difference tool.
Here's a little sample session as an example.
$ git init
Initialized empty Git repository in /home/user/tmp/.git/
$ echo "foo" > foo
$ git add foo
$ git ls-files --stage
100644 257cc5642cb1a054f08cc83f2d943e56fd3ebe99 0 foo
$ echo "bar" > foo
$ git add foo
$ git ls-files --stage
100644 5716ca5987cbf97d6bb54920bea6adde242d87e6 0 foo
$ git cat-file blob 257cc56 > foo.257cc56
$ git cat-file blob 5716ca5 > foo.5716ca5
$ diff foo.257cc56 foo.5716ca5
1c1
< foo
---
> bar
But this is a lot of work and requires careful planning and storing of blob hash values to accomplish.