Git clone 与 Git Fork 的不同(Difference between Git Clone and Git Fork)

本文详细介绍了Forking和Cloning在GitHub上的不同。Forking是在GitHub上创建仓库副本,方便协作并通过Pull Request合并更改;而Cloning则是将仓库下载到本地进行开发。Forking涉及的合并需要原仓库所有者的批准,而Clone后的修改可直接推送到上游仓库。了解这两者的差异对于有效的开源项目协作至关重要。

摘要生成于 C知道 ,由 DeepSeek-R1 满血版支持, 前往体验 >

Forking 与 Cloning 的主要区别

  • 当你fork一个仓库的时候,你创建了一个原来仓库的副本,并且保留在你的GitHub账号里,但是clone是将仓库下载到本地。 Forking is done on the GitHub Account while Cloning is done using Git. When you fork a repository, you create a copy of the original repository (upstream repository) but the repository remains on your GitHub account. Whereas, when you clone a repository, the repository is copied on to your local machine with the help of Git.
    在这里插入图片描述

  • 对fork的仓库做的修改可以通过pull request与原仓库merge,并且发起pull request会通知到原仓库的所有者,拥有者喜欢,才能合并。但对于clone来的仓库,可以直接在本地修改,要发布出去的修改在道德上还是要经过原作者的同意的。Changes made to the forked repository can be merged with the original repository via a pull request. Pull request knocks the repository owner and tell that “I have made some changes, please merge these changes to your repository if you like it”. On the other hand, changes made on the local machine (cloned repository) can be pushed to the upstream repository directly.
    在这里插入图片描述

  • fork是个概念而clone是个过程,fork是GitHub上独立于原来仓库的副本,而clone是用git clone命令把原仓库所有文件下载到本地机器的原仓库的副本。Forking is a concept while cloning is a process. Forking is just containing a separate copy of the repository and there is no command involved. Cloning is done through the command ‘git clone‘ and it is a process of receiving all the code files to the local machine.

fork 与 clone 的使用流程

  • 对于clone到本地的仓库做出修改或者commit后可以直接push
    在这里插入图片描述
  • 对于fork的仓库,做出修改或者commit后,可以发起pull request请求与原仓库进行merge合并
    在这里插入图片描述
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包

打赏作者

starleeisamyth

你的鼓励将是我创作的最大动力

¥1 ¥2 ¥4 ¥6 ¥10 ¥20
扫码支付:¥1
获取中
扫码支付

您的余额不足,请更换扫码支付或充值

打赏作者

实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值