Skip to content

Commit

Permalink
Several clarifications around managing forks (#51882)
Browse files Browse the repository at this point in the history
Co-authored-by: Jessica Schumaker <[email protected]>
Co-authored-by: Zachariah Cox <[email protected]>
  • Loading branch information
3 people authored Aug 8, 2024
1 parent 8e71c13 commit dae93d8
Show file tree
Hide file tree
Showing 5 changed files with 13 additions and 10 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ shortTitle: Collaborative development
---
## Fork and pull model

In the fork and pull model, anyone can fork an existing repository and push changes to their personal fork. You do not need permission to the source repository to push to a user-owned fork. The changes can be pulled into the source repository by the project maintainer. When you open a pull request proposing changes from your user-owned fork to a branch in the source (upstream) repository, you can allow anyone with push access to the upstream repository to make changes to your pull request. This model is popular with open source projects as it reduces the amount of friction for new contributors and allows people to work independently without upfront coordination.
In the fork and pull model, anyone can fork an existing ("upstream") repository to which they have read access and the owner of the upstream repository allows it. Be aware that a fork and its upstream share the same git data. This means that all content uploaded to a fork is accessible from the upstream and all other forks of that upstream. You do not need permission from the upstream repository to push to a fork of it you created. You can optionally allow anyone with push access to the upstream repository to make changes to your pull request branch. This model is popular with open-source projects as it reduces the amount of friction for new contributors and allows people to work independently without upfront coordination.

{% tip %}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,15 +16,15 @@ topics:

## About forks

{% data reusables.repositories.about-forks %} A fork can be owned by either a personal account or an organization.
{% data reusables.repositories.about-forks %} A fork can exist in either a personal account or an organization.

When you view a forked repository on {% data variables.product.product_name %}, the upstream repository is indicated below the name of the fork.

![Screenshot of a repository's page on GitHub. Below the name of the repository, "mona/docs", the text "forked from github/docs" is outlined in orange.](/assets/images/help/pull_requests/fork-path.png)

In open source projects, forks are often used to iterate on ideas or changes before incorporating the changes into the upstream repository. {% data reusables.repositories.about-giving-access-to-forks %}

Deleting a fork will not delete the original upstream repository. You can make any changes you want to your fork, and there will be no effect on the upstream. For example, you can add collaborators, rename files, or generate {% data variables.product.prodname_pages %} on the fork without affecting the upstream. {% ifversion fpt or ghec %} After a fork is deleted, you cannot restore the fork. For more information, see "[AUTOTITLE](/repositories/creating-and-managing-repositories/restoring-a-deleted-repository)."{% endif %} If you delete a private repository, all forks of the repository are deleted.
Deleting a fork will not delete the original upstream repository. Code pushed to a fork will be visible from the upstream, but changes won't have any immediate effect on the upstream branches. For example, you can add collaborators, rename files, or generate {% data variables.product.prodname_pages %} on the fork without affecting the upstream branches. {% ifversion fpt or ghec %} After a fork is deleted, you cannot restore the fork. For more information, see "[AUTOTITLE](/repositories/creating-and-managing-repositories/restoring-a-deleted-repository)."{% endif %} If you delete a private repository, all forks of the repository are deleted.

{% data reusables.repositories.forks-page %}

Expand All @@ -46,6 +46,7 @@ If you want to create a new repository from the contents of an existing reposito

Forking a repository is similar to duplicating a repository, with the following differences.

* Code pushed to a fork is visible to all repositories in the fork network, even after that fork is deleted.
* You can use a pull request to suggest changes from your fork to the upstream repository.
* You can bring changes from the upstream repository to your fork by synchronizing your fork with the upstream repository.
* Forks have their own members, branches, tags, labels, policies, issues, pull requests, discussions, actions, projects, and wikis.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,8 @@ All repositories belong to a repository network. A repository network contains t

If you delete a repository or change the repository's visibility settings, you will affect the repository's forks. For more information, see "[AUTOTITLE](/pull-requests/collaborating-with-pull-requests/working-with-forks/what-happens-to-forks-when-a-repository-is-deleted-or-changes-visibility)"

If you delete a fork, any code contributions of that fork will still be accessible to the repository network.

## About permissions of forks

{% data reusables.repositories.private_forks_inherit_permissions %}
Expand All @@ -55,11 +57,11 @@ For more information, see "[AUTOTITLE](/repositories/configuring-branches-and-me
If you work with forks, or if you're the owner of a repository or organization that allows forking, it's important to be aware of the following security considerations.

* Forks have their own permissions separate from the upstream repository.
* The owners of a repository that has been forked have read permission to all forks in the repository's fork network.
* The owners of a repository that has been forked have read permission to all forks in the repository's network.
* Organization owners of a repository that has been forked have admin permission to forks created in personal user namespaces, including the ability to delete the fork and its branches.
* Organization owners of a repository that has been forked have read permission to forks created in organizations, but do not have the ability to delete the fork or its branches.
* Forks created in another organization will not be deleted when individual access is removed from the upstream repository.
* Commits to any repository in a fork network can be accessed from any repository in the same fork network, including the upstream repository.
* Commits to any repository in a network can be accessed from any repository in the same network, including the upstream repository, even after a fork is deleted.

### About forks within an organization

Expand Down
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
---
title: Allowing changes to a pull request branch created from a fork
intro: 'For greater collaboration, you can allow commits on branches you''ve created from forks owned by your personal account.'
intro: 'For greater collaboration, you can allow commits on branches you''ve created from forks in your personal account.'
redirect_from:
- /github/collaborating-with-issues-and-pull-requests/working-with-forks/allowing-changes-to-a-pull-request-branch-created-from-a-fork
- /articles/allowing-changes-to-a-pull-request-branch-created-from-a-fork
- /github/collaborating-with-issues-and-pull-requests/allowing-changes-to-a-pull-request-branch-created-from-a-fork
- /github/collaborating-with-pull-requests/working-with-forks/allowing-changes-to-a-pull-request-branch-created-from-a-fork
permissions: People with push access to the upstream repository of a fork owned by a personal account can commit to the forked branches.
permissions: People with push access to the upstream repository of a fork in a personal account can commit to the forked branches.
versions:
fpt: '*'
ghes: '*'
Expand All @@ -15,9 +15,9 @@ topics:
- Pull requests
shortTitle: Allow changes to a branch
---
When a user creates a pull request from a fork that they own, the user generally has the authority to decide if other users can commit to the pull request's compare branch. If the pull request author wants greater collaboration, they can grant maintainers of the upstream repository (that is, anyone with push access to the upstream repository) permission to commit to the pull request's compare branch. To learn more about upstream repositories, see "[AUTOTITLE](/pull-requests/collaborating-with-pull-requests/working-with-forks/about-forks)."
When a user creates a pull request from their fork, the user generally has the authority to decide if other users can commit to the pull request's compare branch. If the pull request author wants greater collaboration, they can grant maintainers of the upstream repository (that is, anyone with push access to the upstream repository) permission to commit to the pull request's compare branch. To learn more about upstream repositories, see "[AUTOTITLE](/pull-requests/collaborating-with-pull-requests/working-with-forks/about-forks)."

Pull request authors can give these permissions when they initially create a pull request from a user-owned fork or after they create the pull request. For more information, see "[AUTOTITLE](/pull-requests/collaborating-with-pull-requests/proposing-changes-to-your-work-with-pull-requests/creating-a-pull-request-from-a-fork)."
Pull request authors can give these permissions when they initially create a pull request from a fork in a personal account or after they create the pull request. For more information, see "[AUTOTITLE](/pull-requests/collaborating-with-pull-requests/proposing-changes-to-your-work-with-pull-requests/creating-a-pull-request-from-a-fork)."

You can set commit permissions when you first create a pull request from a fork. For more information, see "[AUTOTITLE](/pull-requests/collaborating-with-pull-requests/proposing-changes-to-your-work-with-pull-requests/creating-a-pull-request-from-a-fork)." Additionally, you can modify an existing pull request to let repository maintainers make commits to your branch.

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ If a public repository is made private and then deleted, its public forks will c

## Changing a private repository to a public repository

When you change a private repository to public, all the commits in that repository, including any commits made in the repositories it was forked into, will be visible to everyone. However, the private forks will not automatically become public. Instead, each private fork will become a separate private repository and create its own independent network of repositories. Any new changes made to these networks will not be accessible from the original repository.
When a private repository is made public, all the commits in that repository, including any commits previously pushed to private forks of that repository, will be migrated to a new public repository network and become visible to everyone. Any previously created private forks will remain private but will become disconnected from the original repository that was made public. Each private fork will become a separate private repository and create its own independent network of repositories. Any new changes made to these networks will not be accessible from the original repository that was made public.

### Deleting the public repository

Expand Down

0 comments on commit dae93d8

Please sign in to comment.