6

Git does not add a modified file

 3 years ago
source link: https://www.codesd.com/item/git-does-not-add-a-modified-file.html
Go to the source link to view the article. You can view the picture content, updated content and better typesetting reading experience. If the link is broken, please click the button below to view the snapshot at that time.
neoserver,ios ssh client

Git does not add a modified file

advertisements

No idea why this is happening:

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)
  (commit or discard the untracked or modified content in submodules)

    modified:   file (modified content)

no changes added to commit (use "git add" and/or "git commit -a")
starkers@ubuntu:~/Documents/currentWork/protection_demo$ git add --all
starkers@ubuntu:~/Documents/currentWork/protection_demo$ 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)
  (commit or discard the untracked or modified content in submodules)

    modified:   file (modified content)

No matter what I do, git commit -am, git commit -a the file will not be added to the commit. Any help?


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.


About Joyk


Aggregate valuable and interesting links.
Joyk means Joy of geeK