Git lists same file modified and not staged for commit?

It means that you made a change to filename.cpp, added that change (with git add), then made another change that has not yet been added.

The “changes to be committed” part means that Git has updated its index with a change. When you run git commit, the changes to the index will be used to create the new commit object.

The “changes not staged” part shows the difference between the index and your working copy.

You can reproduce what you’re seeing like so:

  • Edit filename.cpp
  • Run git status. You’ll see “changes not staged”.
  • Run git add filename.cpp
  • Run git status. You’ll see “changes to be committed”.
  • Edit filename.cpp again
  • Run git status. You’ll see both “changes not staged” and “changes to be committed”.

Does that make sense? It’s always a little tricky explaining how Git works.

Leave a Comment

Hata!: SQLSTATE[HY000] [1045] Access denied for user 'divattrend_liink'@'localhost' (using password: YES)