2
所以我从存储库A克隆了这段代码,并在代码中创建了一个子文件夹B.我的所有工作都在子文件夹中完成,我想将子文件夹置于版本控制之下,但我从不想将B中的更改推送到存储库A.实际上,我认为我甚至没有对存储库A的推送访问权限。我可以将子文件夹B放入存储库B吗?如何把Git仓库放到另一个仓库中?
我听说子模块,但我得到的错误,当我尝试使用它们:(我在子文件夹B向右现在)
[email protected]:~/code$ git init
Initialized empty Git repository in /pathtosubfolder/code/.git/
[email protected]:~/code$ git submodule add .
repo URL: '.' must be absolute or begin with ./|../
[email protected]:~/code$ git submodule add ./
fatal: could not create work tree dir ''.: No such file or directory
Clone of '/pathtosubfolder/code/' into submodule path '' failed
[email protected]:~/code$ git submodule status
[email protected]:~/code$ rm -rf .git
[email protected]:~/code$ git submodule init
You need to run this command from the toplevel of the working tree.
谢谢!
'你需要从工作树的顶层运行这个命令.' –
如果你d不想推,不要推。 :P你拥有的是一个克隆 - 一个基本上独立的副本 - A.你可以在本地进行你想要的所有更改,甚至可以在别处完成并推送它们,而不需要知道。 – cHao
谢谢! [15个字符] – Jessica