我想知道做一个项目的Fork和做一个克隆之间的区别。

如果我已经分叉了一个项目,我只能通过GitHub发送拉请求吗?


当前回答

When you say you are Forking a repository you are basically creating a copy of the repository under your GitHub ID. The main point to note here is that any changes made to the original repository will be reflected back to your forked repositories(you need to fetch and rebase). However, if you make any changes to your forked repository you will have to explicitly create a pull request to the original repository. If your pull request is approved by the administrator of the original repository, then your changes will be committed/merged with the existing original code-base. Until then, your changes will be reflected only in the copy you forked.

简而言之:

Fork & Pull模型允许任何人对现有的存储库进行分叉,并将更改推到他们自己的分叉,而不需要对源存储库授予访问权限。然后,项目维护者必须将更改拉入源存储库。

请注意,在fork之后,您可以在您的机器上本地克隆您的存储库(在您的名称下的存储库)。对其进行更改并将其推送到您的分叉存储库。但是,为了在原始存储库中反映您的更改,您的pull请求必须得到批准。

还有一些有趣的讨论

git的分叉实际上是git的克隆吗?

我如何更新一个GitHub分叉库?

其他回答

简而言之,分叉可能与“在你的GitHub ID/配置文件下克隆”相同。显然,除了少数例外,任何时候分叉都比克隆好。与克隆存储库不同,fork存储库始终与原始存储库进行监视/比较。这使您能够跟踪更改,发起拉请求,并手动将原始存储库中的更改与您的分叉存储库同步。

When you say you are Forking a repository you are basically creating a copy of the repository under your GitHub ID. The main point to note here is that any changes made to the original repository will be reflected back to your forked repositories(you need to fetch and rebase). However, if you make any changes to your forked repository you will have to explicitly create a pull request to the original repository. If your pull request is approved by the administrator of the original repository, then your changes will be committed/merged with the existing original code-base. Until then, your changes will be reflected only in the copy you forked.

简而言之:

Fork & Pull模型允许任何人对现有的存储库进行分叉,并将更改推到他们自己的分叉,而不需要对源存储库授予访问权限。然后,项目维护者必须将更改拉入源存储库。

请注意,在fork之后,您可以在您的机器上本地克隆您的存储库(在您的名称下的存储库)。对其进行更改并将其推送到您的分叉存储库。但是,为了在原始存储库中反映您的更改,您的pull请求必须得到批准。

还有一些有趣的讨论

git的分叉实际上是git的克隆吗?

我如何更新一个GitHub分叉库?

如果你做了提问者暗示的事情(忘记了fork,只是在本地克隆了一个回购,做了更改,现在需要发出一个拉请求),你可以回到正轨:

Fork你想要发送拉取请求的回购 将本地更改推到遥控器 发出拉请求

GitHub上另一个奇怪的微妙区别是,对fork的更改不会计算在你的活动日志中,直到你的更改被拉到原始的回购中。更重要的是,要把一个分叉变成一个合适的克隆,你必须联系Github支持,显然。

摘自:为什么我的贡献没有出现:

Commit was made in a fork Commits made in a fork will not count toward your contributions. To make them count, you must do one of the following: Open a pull request to have your changes merged into the parent repository. To detach the fork and turn it into a standalone repository on GitHub, contact GitHub Support. If the fork has forks of its own, let support know if the forks should move with your repository into a new network or remain in the current network. For more information, see "About forks."

简而言之,“fork”创建了一个托管在你自己的GitHub帐户上的项目副本。

“克隆”使用git软件在您的计算机上下载源代码和它的整个版本历史到该计算机