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

后端 未结 9 1656
谎友^
谎友^ 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:58

    There are two kinds of change notices you can suppress.

    The first is untracked content which happens when you make changes to your submodule but have not yet committed those. The parent repository notices these and git status reports it accordingly:

    modified: modules/media (untracked content)

    You can suppress these with :

    [submodule "modules/media"]
       path = modules/media
       url = git@github.com:user/media.git
       ignore = dirty
    

    However, once you commit those changes, the parent repository will once again take notice and report them accordingly:

    modified:   modules/media (new commits)
    

    If you want to suppress these too, you need to ignore all changes

    [submodule "modules/media"]
       path = modules/media
       url = git@github.com:user/media.git
       ignore = all
    

提交回复
热议问题