【Tools】git fork 自我理解

github or gitlab上都有一个fork的功能,什么是fork的功能,设计改功能的逻辑是什么?

根据下面github官方的介绍,个人理解

fork更多用于开源项目中,由于开源项目涉及的人分散在世界,在没有取得开源软件发起人或成员信任之前,一般不会允许新加入的成员直接新建分支,这样新的开发者就很难参与到开源代码贡献。

有了fork这个功能选项,新的开发者/不具备开源仓库权限开发者,可以fork这个开源项目到自己的repo,这样任何的操作都将是在个人仓库进行的,不会影响到开源软件仓库的演进。当fork的项目发生变更的时候,还可以选择将commit 提交到PR到upstream的仓库。

Working with forks

Forks are often used in open source development on GitHub. 

About forks

A fork is a new repository that shares code and visibility settings with the original “upstream” repository.

Fork a repository

A fork is a new repository that shares code and visibility settings with the original “upstream” repository.

About permissions and visibility of forks

The permissions and visibility of forks depend on whether the upstream repository is public or private, and whether it is owned by an organization.

Configuring a remote repository for a fork

You must configure a remote that points to the upstream repository in Git to sync changes you make in a fork with the original repository. This also allows you to sync changes made in the original repository with the fork.

Syncing a fork

Sync a fork of a repository to keep it up-to-date with the upstream repository.

Allowing changes to a pull request branch created from a fork

For greater collaboration, you can allow commits on branches you've created from forks owned by your personal account.

What happens to forks when a repository is deleted or changes visibility?

Deleting your repository or changing its visibility affects that repository's forks.

posted on 2024-01-05 14:32  esky916  阅读(16)  评论(0编辑  收藏  举报