git submodule modified files status
The way that the status of git submodules is reported has changed a lot over recent versions of git, so you should really include the output of git --version
as well for us to be able to help accurately.
However, in any case, the output of git diff example.com/soundmanager
should tell you more. If you see output with the same commit name, but with -dirty
added to the new version, e.g.:
diff --git a/example.com/soundmanager b/example.com/soundmanager
--- a/example.com/soundmanager
+++ b/example.com/soundmanager
@@ -1 +1 @@
-Subproject commit c5c6bbaf616d64fbd873df7b7feecebb81b5aee7
+Subproject commit c5c6bbaf616d64fbd873df7b7feecebb81b5aee7-dirty
... than that means that git status
in the submodule isn't clean - try cd example.com/soundmanager
and then git status
to see what's going on.
On the other hand, if you see different commit versions, e.g.:
diff --git a/example.com/soundmanager b/example.com/soundmanager
index c4478af..c79d9c8 160000
--- a/example.com/soundmanager
+++ b/example.com/soundmanager
@@ -1 +1 @@
-Subproject commit c4478af032e604bed605e82d04a248d75fa513f7
+Subproject commit c79d9c83c2864665ca3fd0b11e20a53716d0cbb0
... that means that the version that your submodule is at (i.e. what you see from cd example.com/soundmanager && git show HEAD
) is different from the version committed in the main project's tree (i.e. what you see from git rev-parse HEAD:example.com/soundmanager
). If the former is right, you should add and commit the new version of the submodule in your main project, with something like:
git add example.com/soundmanager
git commit -m "Update the soundmanager submodule"
On the other hand, if the latter is what you want, you can change the version that the submodule is at with:
git submodule update example.com/soundmanager
I got in this state by mistakenly adding a submodule by specifically adding a directory instead of just adding the content of a new directory.
I needed just to remove the submodule like this:
git rm --cached path/to/my/new_directory
And then add the contents like I intended to in the first place:
git add path/to/my/new_directory/*
I used the following git command to resolve this problem:
git submodule update --init --recursive