Pull Requests, Step by Step
By the end of this lesson, you'll be able to:
- Walk through the full lifecycle of a pull request from branch to merge
- Write a clear PR description that helps a reviewer understand the change
- Respond to review comments and update a PR without losing history
Prerequisites: "Giving and Receiving Feedback"
The full lifecycle
# 1. Branch (Lesson 2)
git checkout -b feature/loyalty-discount
# 2. Commit with discipline (Lesson 2)
git add .
git commit -m "Add LoyaltyDiscount implementing DiscountStrategy"
# 3. Push and open a pull request
git push origin feature/loyalty-discount
After pushing, opening a pull request (PR) on GitHub (or your platform of choice) invites review before the change reaches main — the same branch that stayed isolated in Lesson 2 now formally requests to be merged.
Writing a PR description that helps a reviewer
## What
Adds a LoyaltyDiscount class implementing DiscountStrategy (SOLID's
Open/Closed principle) for customers with 500+ loyalty points.
## Why
Marketing wants a 15% discount for loyalty program members,
without touching any existing discount logic.
## How to test
1. Create a customer with loyaltyPoints >= 500
2. Apply LoyaltyDiscount to a cart total
3. Confirm the result is 15% off
A good description answers what changed, why, and how a reviewer can verify it — exactly the context a reviewer needs to give a fast, meaningful review instead of guessing at intent from the diff alone.
Responding to review and merging
# after a reviewer requests a change:
git add .
git commit -m "Address review: extract magic number 0.15 into a constant"
git push origin feature/loyalty-discount
# the PR updates automatically with the new commit
Pushing another commit to the same branch updates the existing PR — no need to open a new one. Once every blocking comment (Lesson 5) is resolved and the reviewer approves, the PR merges into main, and the branch has done its job: isolating the work until it was ready to join the shared codebase.
Exercise
As a comment, write a short PR description (What/Why/How to test) for a change that fixes a division-by-zero bug in a DiscountCalculator class.
Show hint
Follow the What / Why / How to test structure shown above.
Pull Requests, Step by Step Quiz
My Notes
Log in to keep private notes on this lesson.
Questions about this lesson
No questions yet — be the first to ask.
Log in to ask a question about this lesson.
Summary
This final lesson ties the whole module together into one concrete walkthrough: branching, committing with discipline, writing a clear PR description, responding to review, and merging.