Stage 6 · Lesson 6 of 8
Forks and keeping them in sync
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
- BookFreePro Git
Scott Chacon and Ben Straub
Chapter 6 covers GitHub itself: forks, pull requests and maintaining a project
- GuideFreeContributing to a Project (GitHub Docs)
GitHub · Beginner
GitHub's own walkthrough of the fork, branch and pull request workflow
Practise
Keep handy
Also worth your time
A widely used commit message convention you will meet in many repositories
- roadmap.sh: Git and GitHubGo deeper
The GitHub half of the map: Actions, projects, security features and more