.gitignore files added inside Git submodules
You should add .gitignore
within each of your submodules.
Since said submodules are like nested Git repo, they take care of their own ignore rules, and their status wouldn't be influenced by the .gitignore
of the parent repo (as explained here).
For a vim-specific setting, as Randy Morris mentions in the comment, see the SO question "Generating tags to different location by pathogen".
Note: as Nick mentions in this comments, and as illustrated by the answer to "Generating tags to different location by pathogen", a config like:
[submodule "path/to/submodule"]
path = path/to/submodule
url = http://github.com/username/repo.git
ignore = untracked # <====
will work and make that submodule ignored by git status
.
But "ignore = untracked
" means at least Git1.7.2.
The config is usually found in the .git/
folder of your repo.
Note: nurettin mentions in the comments:
ignore = dirty
did it for me
Commit aee9c7d details the difference between untracked
and dirty
.
"
dirty
": Only differences of the commit recorded in the superproject and the submodulesHEAD
will be considered modifications, all changes to the work tree of the submodule will be ignored.
When using this value, the submodule will not be scanned for work tree changes at all, leading to a performance benefit on large submodules."
untracked
": Only untracked files in the submodules work tree are ignored, a changedHEAD
and/or modified files in the submodule will mark it as modified.
VonC's recommendation of ignore = untracked
works, but you have to make the change for every such submodule.
If you want to solve the problem once and for all, you can configure a global gitignore pattern on every git repo, by git config --global core.excludesfile ~/.gitignore_global
, then just add doc/tags
to $HOME/.gitignore_global.
See https://help.github.com/articles/ignoring-files.