Git diff says subproject is dirty

后端 未结 9 1756
情话喂你
情话喂你 2020-11-28 17:47

I have just run a git diff, and I am getting the following output for all of my approx 10 submodules

diff --git a/.vim/bundle/bufexplorer b/.vim/bundle/bufe         


        
相关标签:
9条回答
  • 2020-11-28 18:14

    Also removing the submodule and then running git submodule init and git submodule update will obviously do the trick, but may not always be appropriate or possible.

    0 讨论(0)
  • 2020-11-28 18:14

    EDIT: This answer (and most of the others) are obsolete; see Devpool's answer instead.


    Originally, there were no config options to make "git diff --ignore-submodules" and "git status --ignore-submodules" the global default (but see also Setting git default flags on commands). An alternative is to set a default ignore config option on each individual submodule you want to ignore (for both git diff and git status), either in the .git/config file (local only) or .gitmodules (will be versioned by git). For example:

    [submodule "foobar"]
        url = git@bitbucket.org:foo/bar.git
        ignore = untracked
    

    ignore = untracked to ignore just untracked files, ignore = dirty to also ignore modified files, and ignore = all to ignore also commits. There's apparently no way to wildcard it for all submodules.

    0 讨论(0)
  • 2020-11-28 18:19

    To ignore all untracked files in any submodule use the following command to ignore those changes.

    git config --global diff.ignoreSubmodules dirty
    

    It will add the following configuration option to your local git config:

    [diff]
      ignoreSubmodules = dirty
    

    Further information can be found here

    0 讨论(0)
提交回复
热议问题