Linux, terminal and Git

Stage 6 · Lesson 6 of 8

Forks and keeping them in sync

GitHub and working with others

Sometimes you want to contribute to a repository you are not allowed to push to. You it: GitHub makes your own copy under your account. You clone your fork and open from it to the original.

Add the original repository as a second remote called upstream, so you now have two . Then, regularly, run git fetch upstream and rebase or merge upstream/main into your branch to keep it current. On GitHub, the "Sync fork" button does the same for your fork's . This is the everyday workflow, and some companies use it too.

Common trapcommitting directly on your fork's main, which makes every later sync a conflict.

A question to check yourself, an AI practice session and 2 cheat sheet entries come when you add the roadmap to your account. Add it

Resources for this stage

Start with· follow one of these

  • BookFree
    Pro Git

    Scott Chacon and Ben Straub

    Chapter 6 covers GitHub itself: forks, pull requests and maintaining a project

  • GuideFree
    Contributing to a Project (GitHub Docs)

    GitHub · Beginner

    GitHub's own walkthrough of the fork, branch and pull request workflow

Practise

  • A safe repository built for making your first pull request to someone else's project

Keep handy

Also worth your time

Mark this stage as not done?