A fork is your own server-side copy of someone else's repository, created on a hosting platform such as GitHub or GitLab. You can change the copy freely without permission from the original owner, and you can offer your changes back through a pull request.
Why it matters
Forking is the standard way to contribute to open-source projects where you lack write access. The original repository is conventionally called upstream, and your fork is a separate repository that you clone locally. Forks are also used to take a project in a new direction; in that sense a "fork" can mean a long-lived divergent project, such as MariaDB from MySQL. A fork is a hosting feature built on top of Git, not a Git command itself.
Example
git clone https://github.com/you/project.git
cd project
git remote add upstream https://github.com/original/project.git
git fetch upstream
git merge upstream/main # bring your fork up to date
You push branches to your fork (origin) and open a pull request against upstream.
Common mistakes
- Working on the fork's main branch and letting it drift far behind upstream.
- Confusing a fork with a branch, which lives inside one repository.
- Forgetting that forks of private repositories may stay private and have different permissions.
Related
Get notified when this term updates
Plus occasional practical tips on uptime and monitoring, nothing else. Unsubscribe anytime.
This page is general information written by our editorial team and updated when documentation changes. Servers and providers differ, so test changes safely first. See our editorial policy and disclaimer.