开发者

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 rmed 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.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜