A fork is a copy of a repository that you manage. Forks let you make changes to a project without affecting the original repository. You can fetch updates from or submit changes to the original repository with pull requests.
Any user or organization on GitHub can fork a repository. Forking a repository is similar to copying another repository, with two major differences:
- You can use a pull request to suggest changes from your fork to the original repository, also known as the upstream repository.
- You can bring changes from the upstream repository to your local fork by synchronizing your fork with the upstream repository.
You can fork any public repository to your user account or any organization in which you have repository creation permissions. For more information, see "Permission levels for an organization."
You can fork any private repository you can access to your user account or any organization on GitHub Team or GitHub Enterprise in which you have repository creation permissions. For more information, see "GitHub's products."
Deleting a fork does not delete the original upstream repository. In fact, you can make any changes you want to your fork--add collaborators, rename files, generate GitHub Pages--with no effect on the original.
In open source projects, forks are often used to iterate on ideas or changes before they are offered back to the upstream repository for everyone to benefit from. When you make changes in your fork and open a pull request that compares your work to the upstream repository, you can give anyone with push access to the upstream repository permission to push changes to your pull request branch. This speeds up collaboration by allowing repository maintainers the ability to make commits or run tests locally to your pull request branch from a fork before merging.
Private forks inherit the permissions structure of the upstream or parent repository. For example, if the upstream repository is private and gives read/write access to a team, then the same team will have read/write access to any forks of the private upstream repository. This helps owners of private repositories maintain control over their code.
If you want to create a new repository from the contents of an existing repository but don't want to merge your changes upstream in the future, you can duplicate the repository or, if the repository is a template, use the repository as a template. For more information, see "Duplicating a repository" and Creating a repository from a template".