Interview Q&A / Git & GitHub

BeginnerQuick answer1 min readUpdated 3 Oct 2026

How do you link a pull request to an issue so that it closes automatically?

SHORT ANSWER

Write a closing keyword such as Closes

Explain it simply

It is like stapling the tracking slip to a delivery: when the parcel arrives, the ticket is ticked off.

Keywords include close, closes, closed, fix, fixes, fixed, resolve, resolves and resolved, followed by #number. They work in the PR description and in commit messages, and the issue closes when the PR is merged into the default branch, not before. For other repos use owner/repo#42. The sidebar's Development section can also link manually.

Example

text
Pull request description:

Add rupee formatting to the cart total.

Closes #42

What to say in the interview

"I add a keyword like Closes #42 to the PR description or commit message. When the PR is merged into the default branch, GitHub automatically closes the issue, and the two stay linked."

#github#issues#pull-request

Related questions

Practise more Git & GitHub questions

Test your recall with short answers, then return to the detailed explanations when you need context.

Open Git & GitHub quick answers →

Get new questions like this by email

One short email when something new and useful lands. No spam, unsubscribe in one tap.

By subscribing you agree to the Privacy Policy.