Ignore dirty submodule status when committing

I have a repository with a submodule. For me, this submodule is read-only, so I use subodule.Module.ignore = dirty.

This works fine for 'git status', but when I commit, the whole submodule is scanned, and in the git comments I see that it is dirty.

Is there any way to avoid this?

+6
source share
3 answers

Solved upstream in commit 8f6811efed5451c72aa

+1
source

If you really do not want to see changes in the submodule, you can add a line to .git / info / exclude inside the submodule with the '*' template.

This will cause the submodule to always report itself as clean, regardless of what has changed.

echo "*" >> path/to/submodule/.git/info/exclude 
+2
source

You might want to edit the .git/info/exclude file to add a template to ignore. But for the submodule this will not work. Instead, you should edit .git/submodule_foo/info/exclude , from the root of the Git repository.

This is because in newer versions of Git, the submodule_foo/.git path is a file, not a directory. Its contents allow us to find out where the .git files for the submodule are:

 gitdir: ../.git/modules/submodule_foo 
-1
source

Source: https://habr.com/ru/post/901708/


All Articles