

or add -ignore-submodules to your git diff, to temporarily ignore those "dirty" submodules.Īs Noam comments below, this question mentions that, since git version 1.7.2, you can ignore the dirty submodules with: git status -ignore-submodules=dirtyĭo you have adequate permissions to your repo'?.ĭotnetCarpenter comments that you can do a: git submodule foreach -recursive git checkout. To undo all changes to your submodule just cd into the root directory of your submodule and do git checkout. either committing or undoing the changes/evolutions within each of your submodules, before going back to the parent repo (where the diff shouldn't report "dirty" files anymore).It would have been much kinder to users to introduce a different symbol for “at the specified version, but dirty”.
#ADD A GIT SUBMODULE PLUS#
The meaning of the plus sign ( +) in the output of git submodule has changed, and the first time that you come across this it takes a little while to figure out what’s going wrong, for example by looking through changelogs or using git bisect on git.git to find the change. Submodules are now regarded as dirty if they have any modified files or untracked files, whereas previously it would only be the case if HEAD in the submodule pointed to the wrong commit.

Versions 1.7.0 and later of git contain an annoying change in the behavior of git submodule. Make -ignore-submodules=untracked the default for git diff ( man) when there is no configuration variable or command line option, so that the command would not give ' -dirty' suffix to a submodule whose working tree has untracked files, to make it consistent with git describe -dirty that is run in the submodule working tree.Īnd also make -ignore-submodules=none the default for git status ( man) so that the user doesn't end up deleting a submodule that has uncommitted (untracked) files.īy default this is set to untracked so that any untrackedĪs mentioned in Mark Longair's blog post Git Submodules Explained, This is inconsistent with what git describe -dirty ( man) says when run in the submodule directory in that state. Git diff reports a submodule directory as -dirty even when there are only untracked files in the submodule directory.

(Merged by Junio C Hamano - gitster - in commit 0806279, ) diff: do not show submodule with untracked files as " -dirty" See commit 8ef9312 () by Sangeeta Jain ( sangu09). The inconsistency has been fixed with Git 2.31 (Q1 2021). " git diff" ( man) showed a submodule working tree with untracked cruft as Submodule commit -dirty, but a natural expectation is that the " -dirty" indicator would align with " git describe -dirty" ( man), which does not consider having untracked files in the working tree as source of dirtiness.
