skip to content

Pull Request Lifecycle

The path a change takes from draft to merged: open, get checks green, get approvals, then merge with the strategy your team picked. Interviewers ask about squash vs merge commit vs rebase merge because the answer reveals what you think a readable main branch looks like.

part ofGitHuboverview, primer and where to startread it →
on this pageshow

questions

6

In a GitHub pull request description, what does the keyword "Closes #142" actually do?

level: juniorimportance: must knowfreq 62%

answer

  1. It does more than render a link
  2. Two things happen: one now, one at merge
  3. Which branch has to receive the merge?
  4. Description or commit message, never a comment
  5. One keyword per issue, default branch only

basics

~10 s

It links the pull request to issue 142 and closes that issue automatically when the pull request is merged into the repository's default branch. Merging into any other branch links but does not close.

solid answer

~40 s

A closing keyword followed by an issue reference creates a tracked link between the pull request and the issue, shown in the Development section of both. When the pull request is merged into the repository's **default branch**, GitHub closes the linked issue automatically and records that the pull request closed it. The supported keywords are `close`, `closes`, `closed`, `fix`, `fixes`, `fixed`, `resolve`, `resolves`, `resolved`, and they must appear in the pull request **description** or in a commit message — a keyword typed in a review comment or in the title does not create the link. To close an issue in another repository, spell the reference `owner/repo#142`. Each issue needs its own keyword: `Closes #1, closes #2`, not one keyword for a list.

go deeper

for a junior

Know the keyword list and that merging closes the linked issue. Being able to say the keyword belongs in the description or a commit message is enough to pass this screener.

for a middle

Explain the conditions: default branch only, one keyword per issue, and the cross-repository owner/repo#142 form. Expect a follow-up about a merge into a release branch.

for a senior

Talk about the workflow consequences — traceability from an issue to the pull request that closed it, and what your team does when a change is reverted and the issue stays closed.

for a principal

Frame it as tracker hygiene at scale: whether closure should be automatic at merge or gated on a deploy, and what your organisation treats as the authoritative record that work actually shipped.

## What the keyword is for GitHub keeps issues and pull requests in the same numbering space, and a bare `#142` anywhere in a description or comment renders as a cross-reference link. A *closing keyword* does more than link: it declares intent, so that merging the pull request also finishes the issue. That single mechanism removes the most common source of stale trackers — work that shipped but whose issue nobody closed. ## The exact rules - **Keywords.** `close`, `closes`, `closed`, `fix`, `fixes`, `fixed`, `resolve`, `resolves`, `resolved`. Case does not matter. Words such as *completes*, *addresses* or *implements* are ordinary prose to GitHub and create no link. - **Where they must appear.** In the pull request's description, or in a commit message that the pull request contains. A keyword in a follow-up comment or in the pull request title does not create the closing link. - **When the issue closes.** Only when the pull request is merged into the repository's **default branch**. Merging a keyword-bearing pull request into a release branch links the two but leaves the issue open; the issue closes later, when the change reaches the default branch through some other pull request that also carries the keyword. - **One keyword per issue.** `Closes #1, #2` closes only issue 1 and merely references issue 2. Write `Closes #1, closes #2`. - **Cross-repository.** Use `owner/repo#142`. You need permission on the target repository for the close to take effect. ## What it looks like in the interface A linked pull request appears in the issue's *Development* sidebar and the issue appears in the pull request's. The pull request's merge event carries the closure, so the issue's timeline reads "closed via #987", which is the audit trail people actually rely on months later when asking "where did this change come from". ## Why interviewers ask it It is a two-minute question that separates people who have run a real pull request workflow from people who have only pushed branches. The details that trip candidates up are the default-branch condition and the one-keyword-per-issue rule; both cause visible confusion on real teams ("the issue didn't close, the automation is broken") and both have simple explanations. ## Related behaviours worth knowing - **Manual linking.** You can attach an issue to a pull request from the *Development* panel without a keyword, which is useful when the issue lives in a repository whose text you do not want to edit or when the pull request only partially addresses it. - **Reverting.** If the change is later reverted through a revert pull request, the issue does **not** reopen automatically. Reopening is a human decision and someone has to make it. - **Closing the pull request without merging.** Closing a pull request unmerged never closes its linked issues; only a merge into the default branch does. - **Branch-based linking.** Creating a branch from an issue also establishes a link, so the eventual pull request shows the connection without anyone typing a keyword. ## How to phrase a strong answer Start with the effect ("it links the two and auto-closes the issue on merge to the default branch"), then add the constraint that matters ("description or commit message, not a comment, and one keyword per issue"), then the cross-repository form. Mentioning that a revert does not reopen the issue shows you have watched this play out during an incident, which is exactly the extra sentence that turns a correct answer into a convincing one.

  • A pull request with "Fixes #310" is merged into a release branch rather than main. What happens to the issue?
    The issue stays open. GitHub closes a keyword-linked issue only when the pull request merges into the repository's default branch. The link is still recorded, so the issue shows the pull request in its Development panel, and it closes when a pull request carrying the keyword eventually merges into the default branch.
  • How do you close an issue that lives in a different repository from a pull request?
    Use the fully qualified form, `Closes owner/repo#142`, in the pull request description. You need permission on the target repository for the close to take effect. The linkage shows on both sides, and the same default-branch condition applies to the pull request's own repository.
  • If the change is reverted through a revert pull request, does GitHub reopen the closed issue?
    No. Closing is a one-way automation tied to the merge event; a revert does not reverse it. Someone has to reopen the issue deliberately, which is worth building into your incident checklist so reverted work does not silently disappear from the tracker.

saying these in an interview costs you the question

  • Thinks the issue closes on any merge, not the default branch
  • Uses one keyword for a comma-separated list of issues
  • Puts the keyword in a comment or the title and expects a link
  • Believes reverting the pull request reopens the issue
  • Assumes any English verb such as addresses works as a keyword

context

open as a page

On GitHub, how do the squash, merge commit, and rebase merge buttons differ in what they leave on the base branch?

level: middleimportance: must knowfreq 80%

basics

~20 s

A merge commit keeps every PR commit and adds a two-parent commit. Squash and merge replaces them with one new commit. Rebase and merge replays them as new commits with new SHAs and no merge commit.

open as a page

What is a draft pull request on GitHub, and what changes when you mark it ready for review?

level: juniorimportance: should knowfreq 46%

basics

~20 s

A draft pull request is a fully visible pull request that GitHub refuses to merge. Marking it ready enables the merge button and triggers the automatic reviewer requests, including code-owner requests, that GitHub holds back while it is a draft.

open as a page

What does enabling auto-merge on a GitHub pull request do, and when is that option available?

level: middleimportance: should knowfreq 44%

basics

~20 s

Auto-merge tells GitHub to merge a pull request by itself, with a merge method you pick up front, as soon as every remaining requirement is satisfied. It requires the repository's Allow auto-merge setting and a pull request that is not yet mergeable.

open as a page

A merged GitHub pull request broke production — what does the Revert button on that pull request create?

level: seniorimportance: should knowfreq 40%

basics

~20 s

It creates a new branch and opens a new pull request whose diff undoes exactly what that pull request merged. Nothing is written to the base branch until that revert pull request passes the usual checks and is merged.

open as a page

How would you land a chain of five dependent GitHub pull requests without blocking the rest of your team?

level: principalimportance: nice to knowfreq 28%

basics

~20 s

Base each pull request on the previous one's branch so every diff stays small, land the bottom of the stack first, and prefer a merge method that preserves the parent's commits. GitHub retargets the children's base branches automatically as each parent merges.

open as a page