Working together on GitHub · lesson 5 of 7
Commands and ideas in this lesson
AForkyour own hosted copy of someone else's repository
Bupstreamthe remote for the original project
CCONTRIBUTING.mdhow a project wants help

Forks and contributing

Last updated

The Reyes family keeps the main Kusina, and only Lola Remy's children can push to it. Ana can still contribute: she forks it, works in her fork, and asks for her changes to be pulled in. This is also exactly how you contribute to open-source projects. In this lesson you'll keep a fork up to date and learn the etiquette that gets contributions accepted.

By the end of this lesson you can

  • Explain a fork, and the upstream and origin remotes
  • Keep a fork up to date with the project it came from
  • Prepare a contribution the way a project asks: read CONTRIBUTING.md, start small, ask first

Three repositories

A fork is a copy of someone else's repository, made on the host, under your account. You can push to your fork; you can't push to theirs. So contributing involves three repositories:

upstreamreyes-family/kusina, on the host. You can't push here.
↓ Fork button (once), and later
git fetch upstream brings new commits to you
originana/kusina, your fork, on the host
↓ git clone (once) · ↑ git push
your clone~/kusina, on your computer
Then on the host: a pull request from your fork's branch into upstream's main ↑

By convention, your fork is origin (you cloned it) and the original project is upstream (you add it yourself).

Keep your fork up to date

The original project carries on without you. To bring its new commits into your fork:

  1. git remote add upstream <its address>, once.
  2. git fetch upstream.
  3. git switch main, then git merge upstream/main. If you never commit on main yourself, this is always a fast-forward.
  4. git push to update your fork on the host.

Hosts also have a "Sync fork" button that does steps 2–4 on the host; you'd then pull.

Git sandbox
  1. Check your remotes: only origin, your fork
  2. Add the family’s repository as upstream (its address is in the note above)
  3. Fetch upstream and merge its main into yours
  4. Push, so your fork is up to date too
  5. Read the CONTRIBUTING.md that just arrived
  6. Start your contribution on a new branch, add-bibingka, and push it to your fork

Working folder

no changes

Staging area

nothing staged

Repository

10 commits on main

Remote

origin: example.com/ana/kusina.git · in step, as of your last fetch

You are in ~/kusina, your clone of your fork (https://example.com/ana/kusina.git). The family's repository is https://example.com/reyes-family/kusina.git, and it has changed since you forked it.

Commit graph

  1. 67e435d HEAD →mainorigin/main Cover the leche flan with foil
  2. ba04ca2 Add lumpiang shanghai recipe
  3. 98a5edc Add a script that builds the index page
  4. d078487 Make the sinigang steps clearer
  5. 145dc1e Add pancit bihon recipe
  6. 52d1f4d Say how much salt goes in the adobo
  7. 1c17fad Add a README
  8. 9c53888 Add leche flan recipe
  9. 1f359a2 Add sinigang recipe
  10. 601c654 Add adobo recipe

The last step would be a pull request on the host from ana:add-bibingka into reyes-family:main.

How projects want help

Every project has its own way of working. Before you start:

  • Read CONTRIBUTING.md (and the README). It says how to set up, how to run checks, what kind of pull requests are welcome, and how to name branches or write messages.
  • Read the code of conduct, often CODE_OF_CONDUCT.md: how people are expected to treat each other.
  • Look at the issues. Many projects label beginner-friendly ones "good first issue". Comment that you'd like to try one before starting, so two people don't do the same work.

You can search the whole of GitHub for them: label:"good first issue" state:open in the search box, with Issues chosen.

Screenshot of a GitHub search for open issues labelled “good first issue”, with numbered callouts. The numbered list below describes each part.
  1. Issues. The search is showing issues, here over 484,000 of them. Code, repositories and pull requests are other kinds of result.
  2. Repository. Which project the issue belongs to. Look at it before choosing: is it active, is there a CONTRIBUTING.md?
  3. The label. The project’s maintainers marked this as a good place to start.
  4. Who and when. Brand-new issues may not be ready; ones with a recent reply from a maintainer usually are.
A GitHub search for open good first issues. Screenshot of github.com, captured on 5 December 2026, signed out. GitHub changes its pages often, so yours may look a little different; the names in the list stay the same.
  • Ask first for anything bigger than a typo. A five-minute question saves a week of work that doesn't fit.
  • Keep it small. One fix or one feature per pull request. Small pull requests get reviewed; huge ones wait.
  • Be patient and kind. Maintainers are often volunteers. A reply can take days. Answer review comments with changes or questions, not arguments.

Spot the trap: forty files nobody asked for

Spot the trapAna

Ana wants to add one bibingka recipe to a big public recipe project. While she’s in there, she renames all the files to her style, reformats every recipe, and fixes some spelling. Her pull request changes forty files.

What happens if…

Check what you learned

In a fork setup, what do origin and upstream usually mean?
How do you bring the original project’s new commits into your fork?
What should you read before your first pull request to a project?

Sources

Every command on this page behaves as these pages describe, and the sandbox prints what Git 2.55 prints. Hosting features (pull requests, protected branches) come from the host’s own documentation.

All sources for Simple Git