Reputation: 1018
So I have a project with some submodules. All this have worked great until I today tried the Visual studio git tools. I tried to commit a submodule in there. I have since read online that vs git tools don't support submodules properly.
So it seems I am left with a bit of a mess and I am unsure how to sort it out.
when I do a git commit --dry-run I get this: http://db.tt/CRKbC5Gt It is true that I have changed those tests in Memflex submodule but they should not be checked into the main project.
The submodule itself still works, I have checked that in and checked on github, all seems well there.
So my problem lies in that the containing project now seems confused about the submodule. Even tho it has the submodule listed in .gitmodules
If I browse to the submodules it still shows that it is a submodule since it has the correct branch of the submodule, like this: http://db.tt/sTvQQ9qY
If I user tortoise git, it tries to check in every single file of the submodule that i checked in from visual studio, like this: http://db.tt/rtX9rz6r
So in summary: most things still seem to work, all the submodules seem to work as intended. The only problem is that the main project that contains the submodules now try to check in all the files from said submodule.
I tried with git submodule init without luck, as far as i can see it did nothing.
Update: I see what has happened on Assembla where the main project resides: http://db.tt/uscTJ9MB
I think I am on to something here! Only the project I checked in from visual got this directory as well as submodule
Upvotes: 1
Views: 195
Reputation: 1329542
Starting git 1.9.x/git2.0 (Q2 2014), and commit cbaeafc, trailing slash or no trailing slash won't make a difference anymore:
Allow "
git cmd path/
", when the 'path
' is where a submodule is bound to the top-level working tree, to match 'path
', despite the extra and unnecessary trailing slash.
So you won't be able to add by mistake a submodule content to the parent repo (forcing you to cancel that erroneous git add
with a git rm --cached -rf
).
Upvotes: 3
Reputation: 17858
This happens when you use git add <path-to-submodule>/
which is different from git add <path-to-submodule-without-slash>
In second case git starts tracking only the directory understanding that it is actually a reference to a submodule. In first case it thinks you want to track all the contents of the folder as a part of this repo.
Upvotes: 1
Reputation: 1018
I ended up running git rm --cached -rf Memflex/ from my Lib dir like so: http://db.tt/E0SejkDw
This deleted the directory but kept the submodule and thus everything was once again happies in the magical forrest.
Upvotes: 0