Q:

Does `git commit` commit changes that were not added

I'm trying to learn git using the 'Pro Git' book by Scott Chacon. When explaining how to Stage modified files (page 18), i understand with git add the files are scheduled for commit and then commited with git commit. It mentions that a commit is done, only the changes that were added will be actually be commited, and if i change a file again, i'd have to add it againg before commit so that all changes are comitted. The text says:

It turns out that Git stages a file exactly as it is when you run the git add
  command.If you commit now, the version of the file as it was when you last ran the git add
  command is how it will go into the commit, not the version of the file as it looks in your working directory when you run git commit. If you modify a file after you run git add
  , you have to run git add again to stage the latest version of the file.

However, i'm seeing a different behaviour when trying it myself:
$ git status              #start clean
#On branch master
nothing to commit (working directory clean)

$ echo "hello" >> README.TXT 
git-question> git add README.TXT #added change to README

$ git status 
# On branch master
# Changes to be committed:
#   (use "git reset HEAD <file>..." to unstage)
# 
#   modified:   README.TXT
#

$ echo "good bye" >> README.TXT            #change README after adding
$ git status #now 'hello' is added to be committed but not 'good bye'
# On branch master
# Changes to be committed:
#   (use "git reset HEAD <file>..." to unstage)
#
#   modified:   README.TXT
#
# Changes not staged for commit:
#   (use "git add <file>..." to update what will be committed)
#   (use "git checkout -- <file>..." to discard changes in working directory)
#
#   modified:   README.TXT
#

$ git commit -m "only hello" README.TXT        #commit, i would expect just 'hello' gets commited
[master 86e65eb] only hello
 1 file changed, 2 insertions(+)

$ git status         #QUESTION: How come there's nothing to commit?!
# On branch master
nothing to commit (working directory clean)

So the question is: Shouldn't git commit just commit the changes that were added with git add? And if so, why does it commit the second change even if i didn't add it? 

A:

git commit will commit what is currently in the index and therefore what you explicitly added.
However, in your example, you are doing git commit README.TXT which will commit the files you specify, that is the current file README.TXT. Just do git commit -m "only hello" to commit the index.

