为什么 git 会记住更改,但不让我暂存它们?
当我运行 git status 时,我有一个修改列表,但我无法暂存或提交它们。我该如何解决这个问题?
这是在一次巨大的提交中从裸存储库中提取内核模式目录后发生的。
% git status
# On branch master
# Changed but not updated:
# (use "git add <file>..." to update what will be committed)
# (use "git checkout -- <file>..." to discard changes in working directory)
#
# modified: kernelmode/linux-2.6.33/Documentation/IO-mapping.txt
# ...
$ git add kernelmode/linux-2.6.33/Documentation/IO-mapping.txt
$ git status
# On branch master
# Changed but not updated:
# (use "git add <file>..." to update what will be committed)
# (use "git checkout -- <file>..." to discard changes in working directory)
#
# modified: kernelmode/linux-2.6.33/Documentation/IO-mapping.txt
# ...
I have a list of modifications when I run git status
, but I cannot stage them or commit them. How can I fix this?
This occurred after pulling the kernelmode directory from a bare repository somewhere in one huge commit.
% git status
# On branch master
# Changed but not updated:
# (use "git add <file>..." to update what will be committed)
# (use "git checkout -- <file>..." to discard changes in working directory)
#
# modified: kernelmode/linux-2.6.33/Documentation/IO-mapping.txt
# ...
$ git add kernelmode/linux-2.6.33/Documentation/IO-mapping.txt
$ git status
# On branch master
# Changed but not updated:
# (use "git add <file>..." to update what will be committed)
# (use "git checkout -- <file>..." to discard changes in working directory)
#
# modified: kernelmode/linux-2.6.33/Documentation/IO-mapping.txt
# ...
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
git add -u
应该暂存所有修改。git add -u
should stage all your modifications.这应该添加您显示为需要暂存的一个文件。
然而,对两级子目录(而不是问题中的三级)的一些实验表明 git add . 应该添加需要添加的所有内容 - 但对您来说,事实并非如此。
This should add the one file you show as needing to be staged.
However, some experimentation with two levels of sub-directory (instead of three as in the question) suggests that
git add .
should be adding everything that needs to be added - and for you, it is not.