Script Valley
Git and GitHub Complete Course: From Beginner to Advanced
Working with GitHub: Remotes, Push, Pull, and CollaborationLesson 3.4

Pull Requests and Code Review

pull request, PR, code review, review comments, draft PR, PR template, request changes, approve PR

Pull Requests and Code Review

A pull request (PR) is a GitHub feature that formally proposes merging one branch into another. It provides a space for discussion, review, and approval before code reaches the main branch. Pull requests are the cornerstone of team collaboration on GitHub.

DiagramPull Request Lifecycle

IMAGE PROMPT (replace this block with your generated image):

Flat horizontal lifecycle pipeline on white background. Title: Pull Request Lifecycle on GitHub. Seven sequential stage boxes connected by right arrows forming a pipeline. Stage 1: Push Branch — git push origin feature/x. Icon: upload arrow. Fill: light gray. Stage 2: Open PR — GitHub UI, add title, description, link issue (Closes #42). Icon: PR icon. Fill: light #3A5EFF. Stage 3: CI Checks Run — automated tests, lint, build. Icon: gear. Fill: light amber. Green check or red X outcome shown. Stage 4: Code Review — reviewer adds line comments, suggests changes. Icon: magnifier. Fill: light #3A5EFF. Stage 5: Request Changes / Approve — two-way fork: red badge Request Changes loops back to branch, green badge Approved continues. Stage 6: Merge — three merge strategy pills: Merge Commit, Squash and Merge, Rebase and Merge. Fill: solid #3A5EFF white text. Stage 7: Issue Auto-Closed — Closes #42 triggers automatic close. Icon: checkmark. Fill: light green. White background, step numbers in #3A5EFF circles.

Creating a Pull Request

Push your feature branch to GitHub, then navigate to the repository. GitHub typically shows a banner prompting you to create a PR. Click it, fill in a title and description, assign reviewers, add labels, and submit. A good PR description explains what the change does, why it is needed, and how it was tested.

Reviewing a Pull Request

Reviewers can comment on specific lines by clicking the plus button that appears when hovering over code lines. They can suggest exact changes with suggestion blocks that the author can accept with one click. When review is complete, reviewers choose: Approve, Comment, or Request Changes.

Draft Pull Requests

Mark a PR as a draft to signal it is not ready for review but you want early feedback or want to trigger CI checks. Convert it to a ready-for-review PR when complete.

PR Templates

Create a file at .github/PULL_REQUEST_TEMPLATE.md to provide a consistent checklist for every PR in your repository. Include sections for description, testing steps, and checklist items.

Merging Options

GitHub offers three merge strategies: Create a merge commit (preserves all commits), Squash and merge (combines all commits into one), and Rebase and merge (replays commits linearly). Choose based on your team's history preferences.

Up next

Issues, Projects, and GitHub Collaboration Features

Sign in to track progress