Git & GitHub · Collaboration

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.

Intermediate 5 min Lesson 13 of 19Shows Git 2.47 and GitHub.com as of 2026. GitHub changes its layout from time to time; button names stay the same.
Before you start:Pull Requests
0/19 in Git & GitHub
On this page · 5 min · Intermediate

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#

ShellFork workflow from the terminal Illustrative
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
Expected output
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#

  1. Clone your fork (origin).
  2. Add the original as upstream.
  3. Work on a branch and push it to origin.
  4. Open the PR on GitHub.
  5. 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#

Working on your fork’s main

Use a branch per contribution so several PRs can be open at once.

Large unrequested changes

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
Shell Illustrative
git remote add upstream https://github.com/original/app.git

Mini quiz#

Forks and Open Source quizMultiple choice Question 1 of 1

Why fork instead of cloning the original?

Score so far: 0/0

Want more? Practise all Git & GitHub MCQs · Git & GitHub interview questions

My notes#

Saved in this browser.

Progress is saved in this browser. Sign in to sync.