Git子模块和状态队列

时间:2010-10-05 05:05:39

标签: git git-submodules

我在我的vim存储库中添加了两个子模块,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:   bundle/snipmate
   modified:   bundle/yankring

我跑了:

git submodule init
git submodule update
git add .

没有任何事情让它消失。有什么想法吗?

1 个答案:

答案 0 :(得分:3)

这可能是由于git-1.7.0中添加了一个更改,如果子模块包含已修改或未跟踪的文件,则子模块将被标记为 dirty

git status有一个选项--ignore-submodules可忽略具体更改。来自man git-status

--ignore-submodules[=<when>]
              Ignore changes to submodules when looking for changes. <when>
              can be either "none", "untracked", "dirty" or "all", which is
              the default. Using "none" will consider the submodule modified
              when it either contains untracked or modified files or its HEAD
              differs from the commit recorded in the superproject and can be
              used to override any settings of the ignore option in git-
              config(1) or gitmodules(5). When "untracked" is used submodules
              are not considered dirty when they only contain untracked
              content (but they are still scanned for modified content).
              Using "dirty" ignores all changes to the work tree of
              submodules, only changes to the commits stored in the
              superproject are shown (this was the behavior before 1.7.0).
              Using "all" hides all changes to submodules (and suppresses the
              output of submodule summaries when the config option
              status.submodulesummary is set).

(此选项仅在git-1.7.2

中添加