Reputation: 1601
I see ignore = dirty
in a .gitmodule
file.
Example:
[submodule "docs/submodules/netvirt"]
path = docs/submodules/netvirt
url = ../netvirt
branch = .
ignore = dirty
The documentation states:
"dirty" will ignore all changes to the submodules work tree and takes only differences between the HEAD of the submodule and the commit recorded in the superproject into account.
I cant understand what this means. Can someone state this in a simple language?
What I understand is that say when I added the submodule to the super project, it was at state C (HEAD at C) and then later after sometime its now at state F (HEAD at F). ignore=dirty
will only consider changes D, E, F ( which is what it should do! )
Clearly, I have misunderstood something. What is it?
Upvotes: 18
Views: 27415
Reputation: 111
In my case, I had 4 files that got auto-formatted-on-save in vscode, and while the content was no different, the formatting caused them to be seen as modified and not committed. Found those files, undid the formatting and the "dirty" reference went away.
Upvotes: 0
Reputation: 10227
The term "dirty" here means the same as it does elsewhere in Git: the repo in question has tracked files (files that have previously been committed) that have modifications that have not been committed, and/or there are new untracked files.
In the context of the ignore = dirty
setting for submodules, this means that if the submodule is dirty (i.e. if it has tracked files with modifications that have not been committed, and/or new untracked files), such changes will be ignored. What will not be ignored is a difference in the checked-out commit, e.g. where the parent project points to commit C
but the submodule currently has commit F
checked out.
These are the possible states for the submodule, and the status in the parent project with the setting ignore = dirty
:
ignore = dirty
).ignore = dirty
).Upvotes: 20