Lesson Completion
Back to course

Pull Request Templates

Beginner
7 minutes4.7Git

The Hook (The "Byte-Sized" Intro)

"What does this PR do?" "How do I test it?" "Does it have breaking changes?" Without a template, reviewers ask the same questions on every PR. With a template, every PR arrives pre-organized: description, testing steps, screenshots, and a checklist. Reviewers review faster. Authors think more clearly. Quality goes up.

📖 What are Pull Request Templates?

Markdown templates that pre-fill the PR description with a consistent structure, guiding authors to provide the information reviewers need.

Conceptual Clarity

Template locations (GitHub):

LocationScope
.github/pull_request_template.mdDefault template
.github/PULL_REQUEST_TEMPLATE/bug.mdMultiple templates
docs/pull_request_template.mdAlternative location

Essential sections:

SectionPurpose
WhatWhat does this PR do?
WhyWhy is this change needed?
HowHow was it implemented?
TestingHow to test it
ScreenshotsVisual changes
ChecklistPre-merge checks

Real-Life Analogy

A PR template is like a standardized form at the doctor's office. Instead of describing symptoms in a blank page, you fill in structured fields: what hurts, when it started, what you've tried. The doctor (reviewer) gets the right information faster.

Visual Architecture

flowchart TD AUTHOR["Author opens PR"] --> TEMPLATE["📝 Template pre-fills"] TEMPLATE --> WHAT["What + Why"] TEMPLATE --> HOW["How + Testing"] TEMPLATE --> CHECK["✅ Checklist"] WHAT & HOW & CHECK --> REVIEW["👀 Fast, informed review"] style TEMPLATE fill:#0f3460,stroke:#53d8fb,color:#53d8fb style REVIEW fill:#1b2d1b,stroke:#53d8fb,color:#53d8fb

Why It Matters

  • Consistency: Every PR has the same structure — nothing is missed.
  • Speed: Reviewers find information faster.
  • Quality: Authors think through their changes more carefully.
  • Onboarding: New team members know exactly what's expected.

Code

markdown
<!-- .github/pull_request_template.md --> ## What does this PR do? <!-- Describe the change and link the ticket --> Closes # ## Why? <!-- Why is this change needed? --> ## How was it implemented? <!-- Key technical decisions and approach --> ## How to test <!-- Steps to verify the change --> 1. 2. 3. ## Screenshots (if UI change) <!-- Before/after screenshots --> ## Checklist - [ ] Tests pass locally - [ ] No console.log or debug statements - [ ] Documentation updated (if needed) - [ ] No breaking changes (or documented below) - [ ] Self-reviewed the diff ## Breaking changes <!-- List any breaking changes, or "None" --> None

Key Takeaways

  • Place templates in .github/pull_request_template.md for automatic use.
  • Include What, Why, How, Testing, and Checklist sections.
  • Templates guide authors and speed up reviewers.
  • Multiple templates can be offered for different PR types.

Interview Prep

  • Q: What are PR templates and why use them? A: Markdown files that pre-fill the PR description with a consistent structure. They ensure every PR includes necessary information (description, testing steps, checklist), speeding up reviews and improving quality.

  • Q: Where do you put a PR template in a GitHub repo? A: .github/pull_request_template.md for a single default template. For multiple templates, use .github/PULL_REQUEST_TEMPLATE/ directory with separate files (e.g., bug.md, feature.md).

  • Q: What should a PR template include? A: At minimum: What (description of change), Why (motivation), How to test, and a Checklist (tests pass, no debug code, self-reviewed). Screenshots for UI changes and a breaking changes section are also valuable.

Topics Covered

Team StandardsCode Review

Tags

#git#pull-request#templates#code-review

Last Updated

2026-02-13