不知道为什么会这样:
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)
Run Code Online (Sandbox Code Playgroud)
无论我做什么git commit -am,git commit -a该文件都不会被添加到提交中.有帮助吗?
pal*_*ain 18
我想也许Jubobs的评论是正确的.你的"文件"是子模块吗?
对于普通文件,不应出现此行(提交或丢弃子模块中未跟踪或修改的内容).
这是我从git状态得到的:
$ 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")
Run Code Online (Sandbox Code Playgroud)
在README.txt之后,您将看不到(提交或丢弃子模块中未跟踪或修改的内容)和(修改后的内容)
所以你可能需要做git推荐的工作,处理子模块中的内容.
编辑:以前我认为"git add".可以解决问题,但现在我认为不可能.
有同样的问题,不知道为什么,但 .h 文件不会提交。
所以,我重命名了它,就 git 而言,删除了原来的并创建了新的。然后我做出了这些改变。吉特很高兴。
然后我就把它重命名了回来。git 再次很高兴地做出了承诺。
无法解释为什么会发生这种情况,但至少它被修复了。
小智 5
不确定这是否相关,但是在 Linux 和 Windows 之间切换时我遇到了同样的问题。我有 2 个文件,一个是 WEB.config,另一个是 web.config,因为 Windows 不区分大小写,它似乎被混淆了。我重命名了提交的文件,重命名了,再次提交似乎有效果。
小智 5
我有同样的问题。我个人的“ aha”是我之前已将跟踪.git存储库文件添加到子文件夹,因此它被视为子模块。在子文件夹中删除.git后,它很高兴地加入了我的其余文件夹,成为根文件夹中一个.git文件的一部分。我什至不知道子模块,所以也许这也会对某人有所帮助。
| 归档时间: |
|
| 查看次数: |
21919 次 |
| 最近记录: |