Cord
Cord

Reputation: 196

git won't 'add' subdir

git on OSX sees a modified subdir, but won't 'add' it; how can I fix this? THANKS! (I don't believe there are any open files in that subdir)

~/gitrepo/python: git status
# On branch br1
# Changes not staged for commit:
#   (use "git add <file>..." to update what will be committed)
#   (use "git checkout -- <file>..." to discard changes in working directory)
#   (commit or discard the untracked or modified content in submodules)
#
#   modified:   v0/mage-Upload (modified content)
#
no changes added to commit (use "git add" and/or "git commit -a")
~/gitrepo/python: git add v0
~/gitrepo/python: git add v0/mage-Upload    <-- I guess that was unnecessary
~/gitrepo/python: git diff
diff --git a/v0/mage-Upload b/v0/mage-Upload
--- a/v0/mage-Upload
+++ b/v0/mage-Upload
@@ -1 +1 @@
-Subproject commit 7c377092f1f5cbbeecc03ebb533259c23606506e
+Subproject commit 7c377092f1f5cbbeecc03ebb533259c23606506e-dirty
~/gitrepo/python: git commit -a
# On branch br1
# Changes not staged for commit:
#   (use "git add <file>..." to update what will be committed)
#   (use "git checkout -- <file>..." to discard changes in working directory)
#   (commit or discard the untracked or modified content in submodules)
#
#   modified:   v0/mage-Upload (modified content)
#
no changes added to commit (use "git add" and/or "git commit -a")

Upvotes: 1

Views: 2372

Answers (3)

MichaelM
MichaelM

Reputation: 5818

mage-Upload is a Git submodule. You should do the following:

cd vo/mage-Upload
git commit -a (or whatever you want to commit)
cd ../..
git commit -a

That will commit any changes in the submodule, then commit the new submodule version to the main repository.

Upvotes: 0

GoZoner
GoZoner

Reputation: 70135

You apparently have a submodule in 'v0/mage-Upload' - you will need to handle the changes in the submodule before the changes in the 'super module'. Do something like:

cd vo/mage-Upload
git status
git commit    # Careful if the submodule is not on a branch
              #   see 'git submodule' documentation
git push ...  # Specific to your submodule

At this point you can return the the 'super module' and commit the change to the submodule reference.

Upvotes: 2

Frank Sposaro
Frank Sposaro

Reputation: 8531

Try to remove it from the cache and then re-add it

git rm --cached v0
git add v0

Upvotes: 5

Related Questions