Git尝试将子模块文件提交到父项目中

Git尝试将子模块文件提交到父项目中

本文介绍了Git尝试将子模块文件提交到父项目中的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

所以我有一个包含一些子模块的项目.在我今天尝试使用Visual Studio git工具之前,所有这些工作都非常有效.我试图在那里提交一个子模块.从那以后,我在线阅读了vs git工具不能正确支持子模块的情况.

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.

当我执行git commit --dry-run时,我得到以下信息: http://db.tt/CRKbC5Gt确实,我已经在Memflex子模块中更改了这些测试,但是不应将其检入主项目中.

when I do a git commit --dry-run I get this: http://db.tt/CRKbC5GtIt is true that I have changed those tests in Memflex submodule but they should not be checked into the main project.

子模块本身仍然可以正常工作,我已经检查并在github上进行了检查,一切似乎都很好.

The submodule itself still works, I have checked that in and checked on github, all seems well there.

所以我的问题在于,包含项目现在似乎对子模块感到困惑.即使它具有.gitmodules

So my problem lies in that the containing project now seems confused about the submodule. Even tho it has the submodule listed in .gitmodules

如果我浏览到子模块,由于它具有该子模块的正确分支,它仍然显示它是一个子模块,如下所示: http://db.tt/sTvQQ9qY

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

如果我使用乌龟git,它将尝试检入从Visual Studio中检入的子模块的每个文件,例如: http://db.tt/rtX9rz6r

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.

我尝试了git子模块初始化,但没有运气,据我所知它什么也没做.

I tried with git submodule init without luck, as far as i can see it did nothing.

更新:我看到在主项目所在的Assembla上发生了什么: http://db.tt/uscTJ9MB

Update: I see what has happened on Assembla where the main project resides: http://db.tt/uscTJ9MB

我想我在这里做点什么!只有我从Visual检入的项目才获得此目录以及子模块

I think I am on to something here!Only the project I checked in from visual got this directory as well as submodule

推荐答案

我最终从Lib目录运行了git rm --cached -rf Memflex/,如下所示: http://db.tt/E0SejkDw

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.

这篇关于Git尝试将子模块文件提交到父项目中的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

09-03 03:29