Why does git remember changes, but not let me stage them?
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 ad开发者_StackOverflow社区d 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
# ...
git add -u
should stage all your modifications.
git add kernelmode/linux-2.6.33/Documentation/IO-mapping.txt
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.
精彩评论