Add subproject as usual folder to repository

风流意气都作罢 提交于 2020-01-03 10:58:44

问题


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.

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

etc.

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.

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?

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. Those directories that are not tracked are not empty.

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

I get this:

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

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


回答1:


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

First tried:

git submodule deinit

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

git rm --cached yourSubmodule

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



来源:https://stackoverflow.com/questions/27403278/add-subproject-as-usual-folder-to-repository

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!