简体   繁体   English

用子模块分叉github repo?

[英]Fork github repo with submodules?

A friend of mine has written an irc bot, and has the code on github. 我的一个朋友写了一个irc bot,并在github上有代码。 I made a fork, and wrote a few plugins and pushed to my fork. 我做了一个分叉,写了几个插件然后推到我的叉子上。 The owner of the original repo moved the plugins folder to a submodule (I don't even really get that, I've never really used git) and fetching and merging failed, and I couldn't figure out what went wrong. 原始仓库的所有者将插件文件夹移动到子模块(我甚至没有真正得到它,我从未真正使用过git)并且取出和合并失败,我无法弄清楚出了什么问题。

So I deleted my fork, and forked it all over again, but when I did git clone {my github fork} I had an empty plugins folder. 所以我删除了我的fork,并将它重新分叉,但是当我执行git clone {my github fork}我有一个空的插件文件夹。 I'm not sure what I'm doing wrong, or what's the right way to fork a repo that has a submodule thing in it. 我不确定我做错了什么,或者分叉一个有子模块的repo的正确方法是什么。 :/ :/

@manojlds answer below does grab the submodule and grab the stuff to put in the plugins directory, but if I try to add a file and push I can't because it's pointing at the original submodule. @manojlds下面的回答确实抓住了子模块并抓住了插入目录中的东西,但是如果我尝试添加一个文件并推送我不能,因为它指向原始子模块。 I've forked the submodule now too, I just don't know how to make my main repo point to my fork of the submodule instead of the upstream submodule. 我现在也分叉了子模块,我只是不知道如何让我的主要回购点指向我的子模块而不是上游子模块。

You can run: 你可以运行:

git submodule update --init --recursive

( or you can clone using the --recurse-submodules option) (或者您可以使用--recurse-submodules选项进行克隆)

and the plugins folder will be populated. 并将填充插件文件夹。 If you don't understand about submodules, read about them here: http://book.git-scm.com/5_submodules.html 如果您不了解子模块,请在此处阅读: http//book.git-scm.com/5_submodules.html

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM