Forking is one of the most powerful collaboration features available on GitHub, especially when we want to contribute to projects we don’t own.
In simple terms, forking creates our own copy of someone else’s repository on GitHub, so we can experiment, modify code, and propose changes safely.
It’s important to remember: Forking is not a Git feature — it is a GitHub feature. Git manages our code locally. GitHub adds collaboration features like forking and pull requests.
Let’s break it down in a simple, practical way.
1. What Is Forking on GitHub?
When we fork a repository on GitHub:
- A full copy of that repo is created under our GitHub account
- We get our own remote repository that we fully control
- We can modify code freely without affecting the original project
- We can later propose changes through a Pull Request
Forking is often the first step when contributing to public, open-source projects.
Forking vs Cloning (Very Important Difference)
| Action | Where the Copy Lives | Purpose |
|---|---|---|
| Fork | On our GitHub account | For collaboration & contributions |
| Clone | On our local machine | For editing code locally |
In most workflows:
➡️ We fork on GitHub
➡️ Then we clone our fork to our computer
2. When Should We Use Forking?
Forking is extremely useful in several real-world scenarios.
A. When Contributing to Open-Source Projects
This is the most common use case.
Most public repositories do not allow direct changes.
We fork the project, make changes in our copy, then submit a Pull Request.
Open-source contribution workflow:
- Fork the repo
- Clone our fork
- Create a branch
- Make changes
- Push changes to our fork
- Create a Pull Request
This is the global standard used by GitHub contributors everywhere.
B. When We Don’t Have Write Access
If we want to work on a project but don’t have permission to push code:
➡️ Fork the repo
➡️ Work on our copy
➡️ Submit changes via PR
This protects the original project and avoids accidental changes.
C. When We Want to Experiment Safely
Forking gives us a sandbox to try ideas such as:
- new features
- major refactoring
- large experiments
- learning Git and GitHub
We can break things freely without affecting the main repo.
D. When We Want Our Own Customized Version
Sometimes we want to maintain our own version of:
- templates
- tools
- starter projects
- personal forks of popular libraries
Forking gives us 100% ownership of the copy.
3. How We Fork a Repository on GitHub
Forking is very simple:
- Open the GitHub repository
- Click the Fork button (top-right area)

- Choose our GitHub account
- Rename if needed
- Click Create Fork
GitHub instantly creates a copy under our account.
This is our remote repository now.
4. What We Do After Forking
After we fork, there are two important steps.
Step 1: Clone our fork
GitHub gives us a new URL like:
https://github.com/our-username/repository.git
We clone this, not the original repo:
git clone https://github.com/our-username/repository.git
Step 2: Add the original repo as “upstream”
This helps us stay updated with the latest changes.
git remote add upstream https://github.com/original-owner/repository.git
To update our fork:
git fetch upstream
git merge upstream/main
# or
git rebase upstream/main
This keeps our fork in sync with the real project.
5. Forking vs Branching — When Do We Choose What?
Students often get confused between forking and branching.
Here is the simplest comparison:
| Situation | Use Branch | Use Fork |
|---|---|---|
| We own the repo or are part of the team | ✔️ | |
| We want to experiment privately | ✔️ | ✔️ |
| We don’t have write access | ✔️ | |
| We want to contribute to open-source | ✔️ |
⭐ Clear Rule
If we don’t have permission to push to the repository, we must fork.
If we do have permission, branching is enough.
6. How Forking Fits with Pull Requests
Forking and Pull Requests are two halves of the same workflow.
Complete collaboration flow:
- Fork
- Clone
- Create a branch
- Make changes
- Push to our fork
- Open a Pull Request
- Maintainer reviews and merges
This is the professional GitHub workflow used in real teams and open-source communities.
7. Summary
- Forking is a GitHub feature, not a Git command
- It creates our own remote copy of a repository
- Essential when we don’t have write access
- Perfect for open-source contributions
- After forking, we clone our own copy
- We can sync our fork with the original using an “upstream” remote
- Forking → Branching → Pull Request is the standard collaboration workflow
Forking empowers us to participate confidently in real GitHub projects, learn safely, and contribute like professional developers.