如何在首先在本地创建后添加一个 git repo 作为子模块

桑托什

我有以下

project_main
--test1.txt
--text2.txt
--.git
--new_folder  <-- currently its local repo
  --test1.txt
  --text2.txt
  --.git

现在在new_folder我做的

# inside new_folder
git add remote git:someurl
git add -A; git commit -m "first commit"
git push -u origin master

现在如何将new_folderas添加submoduleproject_main

通常我们添加子模块使用(即获取一些远程仓库)

git submodule add -- git://someurl new_folder

但在这里我希望将新创建的 repo 添加为子模块。

马龙·阿贝昆

new_folder父存储库移出并为其创建一个单独的存储库并推送。然后,

cd project_main
git submodule add --name new_folder file:///path/to/new_folder
git add new_folder/
git commit -m 'new_folder is a submodule'

本文收集自互联网,转载请注明来源。

如有侵权,请联系 [email protected] 删除。

编辑于
0

我来说两句

0 条评论
登录 后参与评论

相关文章