不知道为什么会这样:

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)

无论我做什么,git commit -amgit commit -a都不会将文件添加到提交中。有什么帮助吗?

最佳答案

我认为也许Jubobs的评论是正确的。您的"file"是子模块吗?

对于普通文件,此行(在子模块中提交或丢弃未跟踪或修改的内容)不应出现。

这是我从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")

在我的README.txt之后,您将看不到(在子模块中提交或丢弃未跟踪或修改的内容)(已修改内容)

因此,您可能需要执行git建议的操作,以处理子模块中的内容。

编辑:以前我认为“git add”。可以解决问题,但现在我认为不可能。

08-27 23:28
查看更多