Module 10 of 10 · PRs · code review · team workflows

Pull Requests & Collaboration

What is a Pull Request?

A Pull Request (PR) is a request to merge your branch into another branch. It's not a git feature — it's a GitHub feature built on top of git. PRs give your team a structured way to review, discuss, and approve code before it lands in main.

The Full Feature Branch Workflow

  1. 1
    Create a branch: git switch -c feature/add-login
  2. 2
    Make commits on your branch as normal
  3. 3
    Push the branch: git push origin feature/add-login
  4. 4
    Open a PR on GitHub — click "Compare & pull request" or go to Pull Requests → New
  5. 5
    Request reviewers, respond to comments, push additional commits if needed
  6. 6
    Merge the PR once approved — GitHub merges your branch into main
  7. 7
    Clean up: delete the branch on GitHub, then locally: git branch -d feature/add-login

Writing a Good PR Description

A good PR description helps reviewers understand what changed and why. Include:

Code Review Etiquette

As a reviewer:

As the PR author:

Merge Strategies

GitHub offers three ways to merge a PR:

Most teams use Squash and merge so main has one commit per feature.

Draft PRs: Open a PR as a "Draft" while you're still working to signal it's not ready for review. Convert to ready when done.

Protecting Your Main Branch

In GitHub → Settings → Branches → Add rule, you can require:

Final Challenges

Create and switch to a feature branch: git switch -c feature/my-pr
Make a commit on that branch
Push the branch: git push origin feature/my-pr
Switch back to main and merge: git switch main && git merge feature/my-pr
🎉 Course Complete! You've mastered git and GitHub — from your first commit to collaborative pull requests. You're ready for real team projects.
student@git-mastery: ~/my-project (main)