Reputation: 696
I have a repository with a submodule. For me, this submodule is read-only, so I'm using submodule.Module.ignore=dirty.
This works fine for 'git status', but when I commit, the whole submodule is scanned and in git's comments I can see that it's dirty.
Is there a way to avoid this?
Upvotes: 6
Views: 2142
Reputation: 150633
You probably want to edit the .git/info/exclude
file, to add a pattern to be ignored. But for a submodule, this won't work. Instead, you should edit .git/submodule_foo/info/exclude
, from the root of the Git repo.
This is because, in newer versions of Git, the path submodule_foo/.git
is a file, not a directory. Its contents lets us know where the .git
files for the submodule are:
gitdir: ../.git/modules/submodule_foo
Upvotes: -2
Reputation: 3172
If you really never want to see changes to the submodule, you can add a line to .git/info/exclude inside the submodule with a '*' pattern.
This will result in the submodule always reporting itself as clean, regardless of what has changed.
echo "*" >> path/to/submodule/.git/info/exclude
Upvotes: 2