How to make git ignore changes to submodules by default

后端 未结 5 1878
无人共我
无人共我 2021-01-05 12:11

Since gitmodules were introduced in Git, I like to add them like so:

[submodule \"actionbarsherlock\"]
path = actionbarsherlock
url = git://github.com/JakeWh         


        
5条回答
  •  我在风中等你
    2021-01-05 12:49

    I'm not sure about a default option. Were it a binary state (ignore or not), you could get traction with:

    diff.ignoreSubmodules
       Sets the default value of --ignore-submodules. Note that this affects only git diff Porcelain, and not lower level diff commands such as git diff-files.  git checkout also
       honors this setting when reporting uncommitted changes.
    

    But as you're using dirty I'm not sure there's a way to set a default. Regardless, you could do this with a git alias in your $PATH. Write a script that accepts the submodule as an argument and set the proper dirty configuration value, then add that script to your $PATH. Call it git- and it'll be available as git .

提交回复
热议问题