Git: can I suppress listing of 'modified content'/dirty submodule entries in status, diff, etc?

后端 未结 9 1662
谎友^
谎友^ 2020-11-28 02:32

Somewhen (around the 1.6.x releases, I think) git became aware of changes inside submodules. That only serves to annoy me:

$ git status vendor | grep modified:
#          


        
9条回答
  •  忘掉有多难
    2020-11-28 02:53

    Update: See (and upvote) nilshaldenwang's answer regarding the possibility to add to the .gitmodules file a config parameter for ignoring dirty state of a given submodule.

    ignore = dirty
    

    So git 1.7.2 is out and includes the --ignore-submodules option for status.

    From git help status:

    --ignore-submodules[=]
        Ignore changes to submodules when looking for changes.
         can be either "untracked", "dirty" or "all", which
        is the default. 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).
    

    The value that I want is dirty.

    git status --ignore-submodules=dirty
    

    I use an alias because I'm lazy:

    alias gst='git status --ignore-submodules=dirty'
    

提交回复
热议问题