更新时间:2023-12-01 08:20:40
您是否尝试过使用新的结帐功能?好像没有 git submodule remove
,所以你必须手动编辑 .gitmodules
。
如果您想使用签出副本将模块X(已经在版本控制下)添加到模块Y(这是新的):
.gitmodule
(如果有的话,那就更复杂了)。 git status
git clean -xfd
来清除某些中的任何内容。 .gitignore
,如临时构建文件等。 .git
目录 git add X
。
您也可以在X中执行类似于 git clone path-to-Y
的操作,然后执行 rm -rf Y / .git
。
I'm trying to create a new repository and add two projects to it. One of the projects was already under Git source control so I copied the project and removed the .git folder and deleted the repository I had for it. When I add the projects to my repository the one that wasn't under source control gets added fine but the other one gets added as a submodule (green folder on GitHub).
I tried removing the submodule by doing git rm --cached
on it, but it's still there and I can't add the files of the project to the repository.
Have you tried with fresh checkouts yet ? There seems to be no git submodule remove
, so you would have to manually edit the .gitmodules
.
If you want to add module X (which is already under version control) to module Y (which is new) using checked-out copies:
.gitmodule
(if there is, then it's more complicated).git status
to make sure you don't have any uncommitted changes.git clean -xfd
to get rid of anything that's in some .gitignore
, like temporary build files, etc..git
directorygit add X
inside Y.You could also do something like git clone path-to-Y
in X followed by rm -rf Y/.git
.