Don't know if there's a way to do this by default, but you could easily add an alias or script to do it for you.
–
ChristopherOct 31 '12 at 17:22

I don't see how to do that by alias. And as for script, I just hoped git had a default option for it
–
shkschneiderOct 31 '12 at 17:25

Git will treat as an alias any script in $PATH that starts with git-<command> as git <command>. You could just write a shell script that accepts the submodules name, adds it, then issues the submodule.<name>.ignore configuration and just call it git supersubmodule or something.
–
ChristopherOct 31 '12 at 17:38

@Christopher I know I can do that, so they really are no git options for it? Please post an answer with your last comment if so.
–
shkschneiderOct 31 '12 at 17:39

4 Answers
4

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-<command> and it'll be available as git <command>.

I don't think it works. At least it's not working for me (git 1.8.5).
–
Paweł GościckiNov 29 '13 at 13:18

@brianclements What version supports this option?
–
shkschneiderAug 4 '14 at 12:32

I use git 1.9.1 on Ubuntu 14.04. But on second revisit, I think this doesn't work for me either. But then again, alerting me to "new commits" and "untracked content" for my submodules is the behavior I wanted anyway perhaps I misunderstood OP's question.
–
brianclementsAug 5 '14 at 17:46

Currently setting submodule.<name>.ignore and/or diff.ignoreSubmodules to "all" suppresses all output of submodule changes for the diff family, status and commit.

For status and commit this is really confusing, as it even when the user chooses to record a new commit for an ignored submodule by adding it manually this change won't show up under the to-be-committed changes.
To add insult to injury, a later "git commit" will error out with "nothing to commit" when only ignored submodules are staged.

Fix that by making wt_status always print staged submodule changes, no matter what ignore settings are configured.
The only exception is when the user explicitly uses the "--ignore-submodules=all" command line option, in that case the submodule output is still suppressed.
This also makes "git commit" work again when only modifications of ignored submodules are
staged, as that command uses the "commitable" member of the wt_status struct to determine if staged changes are present.