We have a project using several git modules. Some issues were encountered, and I made some changes to my local copy. I don't have commit rights to the modules, so the changes will stay until they are propagated (by other means) to the official release, after which everything will be in sync.
Until then, is there a way in git
, .gitignore
, or .git/info/exclude
to ignore the results of these changes? I don't know what to call them, but in GitHub they look like this:
[] packages/local/Foobar -Subproject commit-[lots of digits]
+Subproject commit-[lots of digits]-dirty
If I have a lot of changed files, it's easy to overlook these to untick them, and I end up getting git/GitHub errors.
In git status --help
, there is a command line flag to ignore submodules:
--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).
If you want to permanently ignore dirty changes, add the ignore field to your submodule configuration in .gitmodules
to dirty like so:
[submodule "foo/bar"]
path = foo/bar
url = git://github.com/foo/bar.git
ignore = dirty
If you want to ignore all changes, add all instead of dirty:
[submodule "foo/bar"]
path = foo/bar
url = git://github.com/foo/bar.git
ignore = all