Open source contribution

Stage 2 · Lesson 2 of 7

Forks, origin and upstream

Git and GitHub for contributors

You cannot push to someone else's , so you it. A fork is a copy of the project that GitHub makes under your account, and you can push to it. When you clone (download) your fork, a remote called points to it.

A remote is just a saved address of another copy of the repository. Then add the original repository as a second remote, usually called upstream: git remote add upstream https://github.com/owner/project.git. From then on, you fetch new work from upstream and push your to origin.

You open from a branch on your fork into the upstream repository. git remote -v shows both. Mixing them up is the classic beginner mistake.

You push to upstream and get rejected, or you fetch only from origin and build on old code.

A question to check yourself, an AI practice session and 2 cheat sheet entries come with the full roadmap. Unlock

Resources for this stage

Start with

  • BookFree
    Pro Git

    Scott Chacon and Ben Straub

    Chapters 3, 5 and 6: branching, contributing to a project, and GitHub forks

Practise

  • The remote levels drill fetch, rebase and pushing while you watch the commit graph

Keep handy

Also worth your time

Mark this stage as not done?