Git won't add modified file

I think maybe Jubobs' comment is correct. Is your "file" a submodule?

This line (commit or discard the untracked or modified content in submodules) should not appear for normal files.

Here is what I get from git status:

$ git status
On branch master
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

no changes added to commit (use "git add" and/or "git commit -a")

You will not see (commit or discard the untracked or modified content in submodules) and (modified content) after my README.txt

So you may need to do what git recommended, work on the content in submodules.

Edit: Previously I thought the "git add ." could solve the issue but now I think it could not.


I had this same problem. My personal "aha" was that I had previously added a tracking .git repository file to a subfolder and thus it was seen as a submodule. After removing the .git in the subfolder, it happily joined the rest of my folders as part of just one .git file in the root folder. I didn't even know about submodules so maybe this will help someone as well.


Not sure if this is relevant or not, but I had the same issue when switching between Linux and Windows. I had 2 files one WEB.config and another web.config since Windows is not case sensitive it seems to have gotten confused. I renamed the file commited renamed back and commited again seems to have works.

Tags:

Git

Git Add