Forks and Open Source
You can’t push to other people’s repositories. A fork is your own copy where you can, and a pull request offers your change back.
On this page · 5 min · Intermediate
On this page
- Learning objectives
- Explanation
- Step-by-step screens
- Code example
- Step by step
- Real-world use
- Common mistakes
- Best practices
- Remember this
- Practice exercise
- Mini quiz
- Related topics
- My notes
- Reading time
- 5 min
- Difficulty
- Intermediate
- Updated
- Nov 25, 2026
Learning objectives#
- Fork a repository
- Contribute through a pull request
- Keep a fork up to date
- Find beginner-friendly issues
Explanation#
Click Fork on any public repository to copy it to your account (asha/awesome-project). Clone your fork, create a branch, commit and push to your fork as usual.
GitHub then offers Contribute → Open pull request, which targets the original repository (the upstream). The maintainers review and merge it — or ask for changes.
Meanwhile the original keeps moving. Sync fork on your fork’s page (or git pull upstream main after adding the upstream remote) brings in their new commits.
Good first contributions: typos in documentation, small bugs labelled good first issue, and translations. Read CONTRIBUTING.md before you start.
Step-by-step screens#
Drawings of github.com, the Git installer, VS Code and a terminal. GitHub changes its layout from time to time; the button names stay the same. The red numbers match the numbered actions under each picture; names on your computer will differ.
Loading pictures…
Code example: Fork workflow from the terminal#
git clone https://github.com/asha/awesome-project.git # your fork
cd awesome-project
git remote add upstream https://github.com/original/awesome-project.git
git switch -c fix/readme-typo
# ...fix the typo...
git commit -am "Fix typo in installation steps"
git push -u origin fix/readme-typo # then open a PR on GitHub
# later: bring your fork up to date
git switch main
git pull upstream main
git push
origin points at your fork, upstream at the original. The PR goes from asha:fix/readme-typo to original:main.
This example is illustrative. Copy or download it and run it in your own environment; the expected output is shown above.
Step-by-step explanation#
- Clone your fork (origin).
- Add the original as upstream.
- Work on a branch and push it to origin.
- Open the PR on GitHub.
- Pull from upstream to stay current.
Real-world use case#
A student fixes a broken link in a popular library’s docs; the merged PR appears on their profile and is a talking point in interviews.
Common mistakes#
Use a branch per contribution so several PRs can be open at once.
Open or comment on an issue first so maintainers agree before you spend days on it.
Best practices#
- Read CONTRIBUTING.md
- Start with good first issue
- One branch per PR
- Sync your fork before starting new work
Remember this#
Fork = your copy.
origin = fork, upstream = original.
PR goes back to upstream.
Practice exercise#
Your task: Add the original repository https://github.com/original/app.git as a remote named upstream.
Show solution
git remote add upstream https://github.com/original/app.git
Mini quiz#
Why fork instead of cloning the original?
Want more? Practise all Git & GitHub MCQs · Git & GitHub interview questions
My notes#
Saved in this browser.