Sikau

Git & GitHub · Day 15 · about 25 min

Pull requests and code review

Propose changes; get them reviewed.

Four eyes see more

On a team, main is protected: nobody pushes to it directly. You push a branch and open a pull request (PR) on GitHub — a page where teammates read your changes, comment, and approve before it's merged.

The pull request flow

  • git switch -c add-search — a branch for the change.
  • Commit your work in small, clear commits.
  • git push -u origin add-search — the branch appears on GitHub.
  • On GitHub: Compare & pull request. Describe what and why; add screenshots for visual changes.
  • Reviewers comment. You push more commits to the same branch — the PR updates itself.
  • Approved and checks pass → Merge. Delete the branch, then git switch main and git pull.
git remote add origin https://github.com/you/cafe.git
git push -u origin main
git switch -c add-search
echo "<input type=search>" > search.html
git add .
git commit -m "Add search box"
git push -u origin add-search
  • A good PR is small (one idea), explains *why*, and says how to test it.
  • Reviewing: be kind and specific — "This could break on mobile because…", not "bad code".
  • Open source: no write access? Fork the repository (your own copy on GitHub), push there, and open the PR from your fork.

The rest of this lesson

  • Reviewing others' codeexplain
  • Writing a PR people want to reviewexplain
  • Review comments arrivepredict
  • PR lifecycleorder
  • Your turnwrite code
  • Badge quizquiz
  • What you learnedrecap

Continue this lesson free — run real code in your browser

Continue with Google

See all 18 lessons of Git & GitHub