【发布时间】:2014-11-20 20:34:55
【问题描述】:
不知道为什么会这样:
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 -am、git commit -a 文件都不会添加到提交中。有什么帮助吗?
【问题讨论】:
-
git add <file>呢? -
您应该发布相关文件的完整路径,而不是“文件”。另外,你在使用子模块吗?
-
文件在你的 .gitignore 文件中吗?
-
@chooban 不过,无论跟踪的文件是否列在
.gitignore中,都无法在该文件中暂存更改。 -
但是你不需要使用 --force 选项吗?