我想知道做一个项目的Fork和做一个克隆之间的区别。
如果我已经分叉了一个项目,我只能通过GitHub发送拉请求吗?
我想知道做一个项目的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上另一个奇怪的微妙区别是,对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项目在您的在线存储库(回购)。 克隆的项目在您的本地机器上(我通常在fork回购后克隆)。
你可以提交你的在线回购(或提交你的本地回购,然后推送到你的在线回购),然后发送拉请求。
项目经理可以在他的主要在线版本中接受您的更改。
如果你做了提问者暗示的事情(忘记了fork,只是在本地克隆了一个回购,做了更改,现在需要发出一个拉请求),你可以回到正轨:
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分叉库?
@AniketThakur的回答很好。下面这个问题还没有人回答。
如果我已经分叉了一个项目,我只能通过GitHub发送拉请求吗?
不。如果您是存储库的贡献者,您可以:制作本地克隆。创建本地分支。向该分支添加提交。将本地分支推回github(在此过程中创建远程分支)。创建一个pull请求,请求将该分支合并到主分支(或任何您喜欢的分支)中。