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: #
In my situation I clone modules as a starting point for a new module in my ZF2 environment. What this does is put its own .git folder into the directory.
Solution in this case is to delete the .git folder (you will likely need to show hidden files to view it).
I prefer to use SourceTree, so the solution for me was to open the submodule repo in SourceTree which shows me list of all untracked files. I then group selected them all then used "Remove".
I was able to do this because I knew all the untracked files weren't actually needed.
If this is a temporary issue, you can go into the submodule folder and run git reset HEAD --hard
but you will lose all your changes inside of the submodule.
It could be due to the detached HEAD
in your submodule branch. If this is the case, go into your submodule path (e.g.: ./bundle/snipmate
), then rungit checkout master
.
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
I got stuck on this issue yesterday, in a project which had close to 12 submodules.
git status
was showing output.
# 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: proj1 (untracked content)
# modified: proj1 (modified content, untracked content)
# ...
To resolve the untracked content error, I had to remove the untracked files from all submodules (all were *.pyc
, *.pyo
files generated by python) using a .gitignore
.
To resolve the other, I had to run git submodule update
which updated each of the submodules.