How to get rid of Git submodules untracked status?

Tomer Lichtash picture Tomer Lichtash · Feb 26, 2011 · Viewed 87k times · Source

I can't seem to get rid of untracked content in Git's submodules. Running git status yields:

# On branch master
# Changes not staged for commit:
#   (use "git add ..." to update what will be committed)
#   (use "git checkout -- ..." to discard changes in working directory)
#   (commit or discard the untracked or modified content in submodules)
#
#    modified:   bundle/snipmate (untracked content)
#    modified:   bundle/surround (untracked content)
#    modified:   bundle/trailing-whitespace (untracked content)
#    modified:   bundle/zencoding (untracked content)
#
no changes added to commit (use "git add" and/or "git commit -a")

Adding the --ignore-submodules parameter hides these messages; but I wonder if there's a way to get rid of this dirt in a more suitable, core-ish, manner.

Answer

ezraspectre picture ezraspectre · Sep 8, 2012

I found this blog post to work overall. By adding the ignore = dirty option to each one of the entries in the .gitmodules file.

[submodule "zen-coding-gedit3"]
    path = zen-coding-gedit3
    url = git://github.com/leafac/zen-coding-gedit3.git
    ignore = dirty