git github 与其他 repos 链接

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/9357442/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me): StackOverFlow

提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-09-10 13:01:05  来源:igfitidea点击:

github linking with other repos

gitgithubgitorious

提问by user391986

I have a project that relies on two repos in github to function. When I submit my project to github how do I link to these two repos? Should I duplicate the files in my own repo or link to the other repo at a specific revision as I don't want it to update and cause incompatibility. I already created my github repo what should I do?

我有一个项目依赖于 github 中的两个存储库来运行。当我将项目提交到 github 时,如何链接到这两个存储库?我应该复制我自己的存储库中的文件还是链接到特定修订版的其他存储库,因为我不希望它更新并导致不兼容。我已经创建了我的 github 存储库,我该怎么办?

采纳答案by manojlds

You can use git submodules to "link" to other projects. See here - http://help.github.com/submodules/

您可以使用 git 子模块“链接”到其他项目。见这里 - http://help.github.com/submodules/

回答by gabra

There is an alternative to submodules that I found out to be more practical: subtree.

我发现子模块的替代方案更实用:subtree

According to this linkthe advantages are:

根据此链接,优点是:

  • Management of a simple workflow is easy.
  • Older version of git are supported (even before v1.5.2).
  • The sub-project's code is available right after the clone of the super project is done.
  • subtree does not require users of your repository to learn anything new, they can ignore the fact that you are using subtree to manage dependencies.
  • subtree does not add new metadata files like submodules doe (i.e. .gitmodule).
  • Contents of the module can be modified without having a separate repository copy of the dependency somewhere else.
  • 管理简单的工作流程很容易。
  • 支持旧版本的 git(甚至在 v1.5.2 之前)。
  • 子项目的代码在完成超级项目的克隆后立即可用。
  • subtree 不需要存储库的用户学习任何新东西,他们可以忽略您使用 subtree 来管理依赖项的事实。
  • subtree 不会像 submodules doe(即 .gitmodule)那样添加新的元数据文件。
  • 可以修改模块的内容,而无需在其他地方拥有依赖项的单独存储库副本。

回答by Wex

GitHub will also allow you to reference another repository in a comment on GitHub or in a commit. For example:

GitHub 还允许您在 GitHub 上的评论或提交中引用另一个存储库。例如:

We should probably handle this with github/enterprise#59

This will add an update to the issue github/enterprise#59with a link to your comment/commit.

这将添加对问题的更新,github/enterprise#59其中包含指向您的评论/提交的链接。

Cross-Repository Issue References

enter image description here

Sure, GitHub's all about social coding, but you can have social repositories, too. You can reference issues between repositories by mentioning user/repository#numberin an issue. Once we see something like that — say, github/enterprise#59 — we'll make sure to update issue #59 in github's enterprise repository and let you know where it was referenced from. This is a part of GitHub Flavored Markdown, which also has a few tricks of its own.

跨存储库问题参考

在此处输入图片说明

当然,GitHub 是关于社交编码的,但您也可以拥有社交存储库。您可以通过在问题中提及user/repository#number来引用存储库之间的问题。一旦我们看到类似的东西——比如 github/enterprise#59——我们将确保更新 github 企业存储库中的 issue #59 并让你知道它是从哪里引用的。这是GitHub Flavored Markdown的一部分,它也有自己的一些技巧。

Read more: https://github.com/blog/967-github-secrets

阅读更多:https: //github.com/blog/967-github-secrets