Git submodule untracked after merge of "previous" branch
My git repos contains a master branch with the development version of our application and a branch for each released (or currently tested) version of the application.
Since the last branch we added a submodule to the master (=development) branch.
Today I had to make a few changes on the last branch wh开发者_如何学Cich doesn't contain the submodule. When I check out this branch I always get a warning "warning: unable to rmdir Path/To/Submodule: Directory not empty" and the "Path/To/Submodule" will be listed as "untracked" when you do a "git status". After making changes I always make certain that I selectively add the files before committing, so that I don't accidentally add the "Path/To/Submodule" to this branch.
When checking out the master branch again and simply merge using "git merge " the submodule is now listed as "untracked" in the master branch.
Looking at .gitmodules the submodule is still defined...
Any hints about how to recover this? Do I need to re-init the submodule?
Cheers, Niels
I don't believe you would get those symptoms unless that directory was tracked at some point in your last branch's history then git rm
ed for some reason.
That being said, if you re-init your submodule now, the next merge shouldn't remove it again, because the rm
commit has already been merged. That's certainly easier than trying to rewrite your last branch's history so the subdirectory was never present in the first place.
精彩评论