4.2. Linking PRs to Issues, Templates, and Assignments
Issues and pull requests look like separate tabs, but GitHub wires them together tightly enough that the exam treats the connection as its own testable fact.
💡 First Principle: A pull request description can reference an issue with a closing keyword (Closes #12, Fixes #12, Resolves #12), and merging that pull request automatically closes the linked issue — no manual bookkeeping required. Templates and assignments layer structure on top: issue and PR templates pre-fill new items with the fields a team wants filled in every time, and assignees make ownership explicit at a glance. Search filters (also called qualifiers, like is:open, label:bug, or assignee:@me) narrow a long issue or PR list down to exactly the ones matching those same fields — the templates decide what gets recorded, and filters let you find items by what was recorded.
How the pieces fit together:
- An issue is filed (optionally starting from an issue template with required fields)
- A pull request is opened with
Closes #<issue-number>in its description - Reviewers are requested; an assignee is set to track who owns getting it merged
- Merging the pull request automatically closes the referenced issue
⚠️ Exam Trap: The auto-close only fires on merge, not on opening the pull request. A PR that references Closes #12 but gets closed without merging leaves issue #12 open.
Reflection Question: A pull request's description says "Closes #45." If a reviewer closes that pull request without merging it because the approach was rejected, what happens to issue #45?