CurriculumGitHub FundamentalsPull Requests
Lesson 4 of 850%
Intermediate10 min+100 XP

Pull Requests

A Pull Request (PR) is a proposal to merge your branch into another. It opens a structured conversation — teammates can review code line by line, leave comments, request changes, and approve. PRs are the quality gate for all team development.

01.The Pull Request Lifecycle

Create a descriptive branch from main → make focused commits → push branch → open PR on GitHub (describe what and why) → reviewers are notified → discussion and line-by-line code review → author addresses feedback → reviewer approves → PR is merged → branch is deleted. This structured process prevents bugs from reaching production.

Branch Visualization
featuremainHEAD
main
feature
HEAD

02.Writing a Pull Request That Gets Reviewed Fast

Include: A clear title summarizing the change. A description explaining WHY (not what — git log shows that). Screenshots or recordings for any UI changes. Step-by-step testing instructions. Issue references: "Closes #42" auto-closes the linked issue when merged. What trade-offs or alternatives were considered. Keep PRs small — under 400 lines is ideal.

Commit Timeline
a1b2c3d
init
b2c3d4e
feat
c3d4e5f
fix
d4e5f6a
HEAD

Commands

commands — click to reveal output
$
git checkout -b feature/dark-mode
Create a focused feature branch
$
git add . && git commit -m "Add dark mode toggle to settings"
Commit your changes
$
git push -u origin feature/dark-mode
Push branch to GitHub
▼ show output
$
# GitHub: "Compare & pull request" button appears
Click to open the PR form
$
gh pr create --title "Add dark mode" --body "Closes #15 Adds a toggle in Settings > Appearance."
Create PR via the GitHub CLI
$
gh pr status
Check your open PR status
▼ show output
$
gh pr merge 23 --squash
Merge a PR via CLI (squash strategy)
KNOWLEDGE CHECK

What is the main purpose of a Pull Request?

Rate this lesson:
PreviousNext Lesson