Open source contribution

Stage 2 · Lesson 3 of 7

Feature branches

Git and GitHub for contributors

Every contribution goes on its own , a branch made for one change. Create it from the latest upstream main: run git fetch upstream, then git switch -c fix-date-parsing upstream/main. Never to your 's main branch.

A clean main means you can always update it from upstream and start new work from a known state. One branch per change also means one per change, which strongly prefer. Name branches after the change, such as docs-install-link or fix-1234-timezone, and delete them once merged.

What if you realise you committed to main? Create a branch at that commit, then reset main back to upstream before you push anything.

A question to check yourself, an AI practice session and 1 cheat sheet entry 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?