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: # modified: vendor/rails (modified content)
$ git diff vendor/ diff --git a/vendor/rails b/vendor/rails --- a/vendor/rails +++ b/vendor/rails @@ -1 +1 @@ -Subproject commit 046c900df27994d454b7f906caa0e4226bb42b6f +Subproject commit 046c900df27994d454b7f906caa0e4226bb42b6f-dirty
Please make it stop?
Ok, so I have an answer. Now I have another question:
Can I put this in ~/.gitconfig
? From my initial it appears that I cannot, and I didn't see anything promising by skimming the patch. (I guess I can still make an alias.)
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[=<when>] Ignore changes to submodules when looking for changes. <when> 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'