1

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")
Cord
  • 196
  • 11
  • It says `commit or discard the untracked or modified content in submodules` ... you are using submodules. – J-16 SDiZ Jun 20 '12 at 14:33

3 Answers3

5

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

git rm --cached v0
git add v0
Frank Sposaro
  • 8,511
  • 4
  • 43
  • 64
  • can I blow away .git/ and just re-initialize local repo? – Cord Jun 20 '12 at 14:54
  • I'm not sure how you have your project setup, but in my experience with git deleting stuff and trying to start over usually ends up in more of a headache somewhere else (unless it's all from starch). – Frank Sposaro Jun 20 '12 at 14:56
  • ok, thanks for your comments. BTW: How should I 'close' / terminate this SO question? – Cord Jun 20 '12 at 15:04
  • I don't believe either of us has enough points to do that. I would just leave it open. Someone may still come along with a better answer. – Frank Sposaro Jun 20 '12 at 15:06
  • I see there is a mystery .git/ in the subdir; looks like a possible duplicate: http://stackoverflow.com/questions/5186371/problem-with-modified-files-showing-up-in-git-but-not-updating?rq=1 – Cord Jun 20 '12 at 15:12
2

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.

GoZoner
  • 67,920
  • 20
  • 95
  • 145
0

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.

MichaelM
  • 5,518
  • 2
  • 30
  • 23