分叉 git repo 的目的是什么?

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/8275493/
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-19 06:11:40  来源:igfitidea点击:

What's the purpose of forking a git repo?

gitgithubfork

提问by SundayMonday

After working through this Github tutorialI'm more confused than when I started. I thought forking a repo would essentially create a copy of the repo with some other user-specified name. Then I can commit to the new repo without thinking about the repo from which I forked.

在完成了这个Github 教程之后,我比开始时更加困惑。我认为 fork 一个 repo 基本上会创建一个 repo 的副本,其中包含一些其他用户指定的名称。然后我可以提交新的 repo,而无需考虑我从中分叉的 repo。

Unfortunately this doesn't seem to be the case. I browsed to one of my own repos (this may be a problem) and clicked "Fork" on Github. Nothing happened. I completed the tutorial but nothing seems to have changed. Editing/committing/pushing still goes to the original repo.

不幸的是,情况似乎并非如此。我浏览到我自己的一个存储库(这可能是一个问题)并在 Github 上单击了“分叉”。什么都没有发生。我完成了教程,但似乎没有任何改变。编辑/提交/推送仍会转到原始存储库。

回答by David Hu

You fork somebody else's repo:

你 fork 别人的 repo:

At some point you may find yourself wanting to contribute to someone else's project, or would like to use someone's project as the starting point for your own. This is known as “forking.”

在某些时候,您可能会发现自己想要为其他人的项目做出贡献,或者想使用某人的项目作为您自己的项目的起点。这被称为“分叉”。

It creates a copy of the repository, with all its history, for you, to which you can commit. Try forking the Spoon-Knifeproject as suggested in the tutorial.

它会为您创建存储库的副本,其中包含其所有历史记录,您可以提交。尝试按照教程中的建议分叉Spoon-Knife项目。

The fork-and-pull model of open-source development allows anybody to start making changes without initially confronting or requesting permission from the project owners.

开源开发的 fork-and-pull 模型允许任何人开始进行更改,而无需最初面对或请求项目所有者的许可。

You can then send pull requestsfrom your forked repo to the original repo, if you wish to contribute back.

然后,如果您希望回馈,您可以将拉取请求从您的分叉存储库发送到原始存储库。

回答by Lazy Badger

  1. You have to fork foreign repo, to which you haven't commit access, in order to get your repo with full rights
  2. You have to create local clone of forked repo for work with it
  1. 您必须分叉您尚未提交访问权限的外国回购,以便获得完全权利的回购
  2. 您必须创建分叉存储库的本地克隆才能使用它