将子项目作为常规文件夹添加到资源库 [英] Add subproject as usual folder to repository

查看:100
本文介绍了将子项目作为常规文件夹添加到资源库的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我注意到在我的目录中,有两个模块是我的Git存储库的子项目.发生这种情况是因为我将它们全部移到了一个Git存储库中,并且那些模块(目录)具有自己的.git目录.

I noticed that in my directory there were two modules that had been Subprojects of my Git repository. That happened because I moved them all to one Git repo and those modules (directories) had their own .git directory.

当我在那些模块中进行了任何更改时,我的主Git存储库中都看不到任何更改.我只会看到这个:

When I changed anything in those modules I would not see any changes in my main Git repository. I would see only this:

+Subproject commit e97ff0348e6adc697192ca4e6a367bdaeddcda6b-dirty

但是我不需要.我只需要一个Git存储库,而没有任何子项目.因此,我删除了这些子项目中的.git目录.现在我在主存储库上根本看不到任何更改.

But I don't need that. I only need one Git repository without any subprojects. So I deleted .git directories inside those subprojects. And now I don't see any changes at all on my main repository.

我尝试了add *git init.但是,即使它位于存储库中,它也看不到那些目录.如何让Git查看这些目录,以便像其他模块一样跟踪它们的更改?

I tried add * and git init. But it just does not see those directories even though it is inside repository. How can I make Git see those directories, so it would track their changes like other modules?

我的Git存储库看起来像这样:

My Git repository looks something like this:

my_project/
 .git
 dir1
 dir2
 dir3 # Let's say this is the one directory that Git does not see. So any changes I make here are not tracked at all.
 ...
 ...

P.S.那些未跟踪的目录也不为空.

P.S. Those directories that are not tracked are not empty.

更新 如果我重命名该目录,请执行以下操作: git diff

Update If I rename that directory, then doing this: git diff

我明白了:

diff --git a/dir3 b/dir3
deleted file mode 160000
index e279fc4..0000000
--- a/dir3
+++ /dev/null
@@ -1 +0,0 @@
-Subproject commit e279fc481b9706ad79b24281efdbabd55179aee8

如果我将该目录重命名为原始名称,则执行git diff,则不返回任何内容,或者仅返回未完成的更改.

If I rename that directory back to original name, then doing git diff, returns nothing or just that there were no changes done.

推荐答案

在提出建议后,我查看了以下内容:

After suggestion I looked at this: un-submodule a git submodule

第一次尝试:

git submodule deinit

在此之后,它并没有改变旧的行为.但是当我这样做时:

After this it didn't change the old behavior. But when I did this:

git rm --cached yourSubmodule

然后将其删除为子模块,并且git开始在主存储库中看到这些模块.

Then it removed it as submodule and git started seeing those modules in main repository.

这篇关于将子项目作为常规文件夹添加到资源库的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆