ProfK ProfK - 3 months ago 6
Git Question

Why won't Git include this file?

I am trying the following commit (in Posh-Git on PowerShell):

C:\Dev\Android\Projects\HeavyWeights [master ≡ +0 ~1 -0 !]> git commit -a
On branch master
Your branch is up-to-date with 'origin/master'.
Changes not staged for commit:
modified: DotNetHeavyWeights (modified content)


The file isn't untracked, but I did try this anyway, with the exact same results for the commit attempt:

C:\Dev\Android\Projects\HeavyWeights [master ≡ +0 ~1 -0 !]> git add DotNetHeavyWeights


I added the
DotNetHeavyWeights
folder to the root
HeavyWeights
root folder last night, and the commit went fine.

Why won't Git include this folder in the commit?

Answer
DotNetHeavyWeights (modified content)

That means it is a nested Git repo (the is a .git folder in it) or a submodule (look for a .gitmodules file in your main repo).

You need to add, commit and push within that DotNetHeavyWeights folder, before going back to the parent repo, add, commit and push the new SHA1 represented by that submodule (ie the gilink, a special entry in the index)

git add DotNetHeavyWeights 
# no trailing slash
Comments