GitHub 包含来自另一个存储库

标签 git github

我是 github 的新手。

我的机器上有一个 github 存储库。我想在我的 repo 中包含另一个 repo (作为第三方)。我相信我应该先做一个 fork 。但是我如何将它包含在我的本地存储库中呢?

我试过子模块但没有成功...

谢谢。

最佳答案

git submodule仍然是推荐的方式:您可以声明 ( git submodule add ) 一个不属于您的 repo 协议(protocol),或者一个 fork (by definition, belongs to you )。

不过别忘了,那:

  • 您仍然需要 git submodule update --init 才能看到该子模块 repo 及其完整内容显示在您的 repo 中
  • 添加并提交 special entry表示主(父)仓库中该子模块的根目录,以及 push that commit , 以验证该声明。

关于GitHub 包含来自另一个存储库,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/17775828/

相关文章:

git - Git merge 顺序的差异?

xcode - 无法推送到远程 git 存储库

git cherry-pick 不获取远程分支

github - 为TeamCity构建配置选择Git分支

git - 撤消自上次推送以来 git 中的更改?

git - 如何 "force"来自特定提交的 pull 请求?

github - 是否有集成 Assembla/GitHub 的云 IDE?

github - 困惑 : GitHub Project broken(? ), 指令不明确 : Mercurial setup(? )

heroku - Github,如何调试 "failed to refresh the working directory"

Git rebase : fixup multiple commits with one commit