Contributing to Someone Else's Project
Topic 40

Contributing to Someone Else's Project

Open Source

You have found a typo in the documentation of a tool you use every day. You know exactly what it should say. And you cannot push the fix, because you have no access to that repository.

The route around it is a fork: your own copy of their repository, under your account, where you can do anything you like — and from which you can propose a change back to the original.

What a fork is

GitHub makes a copy of the repository under your username. It is an ordinary repository in every respect, and it remembers where it came from, which is what lets GitHub offer a pull request from your copy to theirs.

Like the pull request itself, a fork is a GitHub feature rather than a Git one. Git only ever sees repositories and remotes.

The full loop

Fork on the website, then everything else is Chapter 8 with one extra copy in the chain:

Clone your fork, not the original
git clone git@github.com:YOUR-USERNAME/their-project.git
cd their-project
git switch -c fix-install-typo
Make the change, commit, push to your fork
git add README.md
git commit -m "Fix the package name in the install instructions"
git push -u origin fix-install-typo

Then open a pull request on GitHub — from your fork's branch, into the original repository. GitHub offers this the moment it notices the new branch, and it fills in both ends for you.

Notice that origin here is your fork, not the original project. That is the one detail that trips people up, and it is why the clone command above uses your username.

Three repositories, and what moves between them
The original — someone else's account
You can read itno push access
Receives your pull requestthe maintainer decides
Your fork — your account
A full copy you controlpush freely
Your clone — your laptop
origin points at your forknot at the original

Read the rules first

Many projects have a CONTRIBUTING.md file saying how they want to be approached: whether to open an issue before writing anything, how they want commits formatted, what they will and will not accept.

Read it before you start. Ignoring it is the fastest way to have genuinely good work declined, and it is entirely avoidable.

Also skim the open issues. Someone may already have reported your typo, and a project with two hundred untouched issues and no commits for three years is telling you something about how long your pull request will sit there.

Etiquette

One change per pull request. A typo fix and a feature idea in the same proposal cannot be accepted separately, so both wait for agreement on the harder one.

Explain what and why. The maintainer has never met you and has no context. Two sentences is usually enough.

Be patient. Most maintainers are volunteers doing this in evenings. A week of silence is normal and is not about you.

Take a no gracefully. A declined pull request is not a wasted one — you learned the codebase, and the maintainer's reason is usually something you could not have known.

A realistic first contribution

A typo. A broken link. A missing step in an install guide. A sentence that is technically correct and impossible to follow.

These sound trivial and they are genuinely valued, because they are exactly the problems that maintainers cannot see any more — they know how the thing works, so the missing step is invisible to them. Documentation fixes are how a very large number of open-source contributors started.

On Sandpiper: Theo uses a small photo-gallery script and finds its README missing a step. He forks it, fixes the step, and opens his first pull request to a stranger, using nothing that this book has not already taught.

Common Confusions
  • "A fork is a Git command." It is a GitHub action. Git has no notion of forks; your fork is simply another repository.
  • "Forking is how you save a copy of someone's project." Cloning is for using it. Forking is for proposing changes back, or for taking the project in your own direction.
  • "My pull request must be substantial to be worth opening." Documentation fixes are among the most appreciated contributions in open source, and they are how most people start.
  • "origin will point at the original project after I fork." It points at whatever you cloned. Clone your fork, or you will not be able to push.
Why It Matters
  • A merged pull request on someone else's project is the most credible thing a beginner can put on a portfolio, and it is reachable in an afternoon.
  • The fork loop is Chapter 8's seven steps with one extra copy, which is the proof that the book's model generalizes rather than being a special case.
  • Reading CONTRIBUTING.md first is the difference between a contribution that lands and one that is declined for reasons that were written down in advance.

Knowledge Check

Why do you need a fork to contribute to a stranger's project?

  • Because you can read their repository but cannot push anything back into it
  • Because Git cannot create branches in a repository owned by somebody else
  • Because their repository is read-only until a maintainer grants you access
  • Because cloning a public repository is not permitted without forking first

After forking, which repository should you clone?

  • Your fork, so that origin points at a repository you are able to push to
  • The original, since that is where the pull request will eventually be sent
  • Either one, because GitHub redirects pushes from a fork to the original
  • Neither — you edit the files directly on GitHub's website after forking

Which file tells you how a project wants to be approached?

  • CONTRIBUTING.md, which most established projects include for exactly this
  • README.md, which always contains the full contribution process
  • LICENSE, which sets out the terms under which changes are accepted
  • .gitignore, which lists the files that contributors must not modify

Why are documentation fixes valued more than beginners expect?

  • Because maintainers cannot see the missing step any more, and a newcomer can
  • Because they are the only kind of change that does not require code review
  • Because maintainers dislike writing documentation and outsource it wherever possible
  • Because they are quick to merge, so maintainers accept them without reading

You got correct