Intermediate · 6 min read
Forks and pull requests
The workflow to contribute to a project, yours or someone else's.
One branch per change
Start from an up-to-date main, create a branch, commit, push it. Then open the pull request on GitHub.
Safe
$ git switch main$ git pull$ git switch -c fix/typo-readme$ git push -u origin HEAD
Contributing with a fork
No write access? Fork the project, clone your fork (origin), and add the original as upstream to stay up to date.
Safe
$ git remote add upstream git@github.com:ORIGINAL/REPO.git$ git fetch upstream$ git rebase upstream/main
Update the PR after review
Just commit and push on the same branch: the PR updates itself. Rebased? Push with --force-with-lease.
A good PR
Small, one topic, a description that explains why, and screenshots for UI changes. Reviewers are humans too.