You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Add issue linking to PRs via gh pr edit --add-issue <number> #11405
blockedenhancementa request to improve CLIgh-prrelating to the gh pr commandneeds-designAn engineering task needs design to proceedplatformProblems with the GitHub platform rather than the CLI client
Allow users to link an Issue to a PR via the CLI, without the requirement of using specific keyword in the description, or merging into the default branch.
Do so by adding a --add-issue <number> flag.
For example:
develop <-- feature/123 (PR number 123) gh pr edit 123 --add-issue 1
See the below screenshot for an example of how this can currently be achieved manually.
Proposed solution
Providing this command will allow users to automate linking github issues for reference without the requirement of adding "closes, fixes...etc" to the description, and more importantly, allows automation to creation links to PRs going into the NON-default branch.
Additional context
Example through the UI:
Reacted by Brian, William Davis, joshhenrich, PerkCity22, Andrey Kozhev, Hannes Schmidt, Will Dean, MantisClone, Jason, Tomochika Hara and 10 more
Reacted by Babak K. Shandiz, Heloi Neto, LDWNS and Romulo Pulcinelli Benedetti
Thank you for your issue! We have categorized it as a feature request, and it has been added to our backlog. In doing so, we are not committing to implementing this feature at this time, but, we will consider it for future releases based on community feedback and our own product roadmap.
Unless you see the
help wantedContributions welcome
label, we are not currently looking for external contributions for this feature.
If you come across this issue and would like to see it implemented, please add a thumbs up! This will help us prioritize the feature. Please only comment if you have additional information or viewpoints to contribute.
Personally, I think this would be a valuable feature, but there's a problem here, and that's there's no official GitHub API endpoint (neither REST nor GraphQL) available for this purpose. The web front-end uses GUI-exclusive API endpoints that are not part of the official GitHub API. Therefore, gh cannot (and should not) interact with them.
That said, I'm going to bring this up internally and will update you here.
For now, I'll label this as blocked due to platform capabilities.
Thank you for the update @babakks . I've been hoping for the feature for around a year now and thought it was about time to bring it up. I hope at some point this becomes available, as linking PRs to Issues is incredibly useful for tracking changes.
I got an update from the platform team, and it confirms our observation that there's no API for linking. Also, there's no plan for supporting this through the API.
So, this issue remains blocked until the API supports the use case.
Reacted by William Davis, joshhenrich, PerkCity22, su-ah, Will Dean, MantisClone, Jason and LDWNS
I got an update from the platform team, and it confirms our observation that there's no API for linking. Also, there's no plan for supporting this through the API.
So, this issue remains blocked until the API supports the use case.
@babakks thanks for checking with the platform team. Hit this today. Stacked PRs (Graphite, ghstack, etc.) only have one PR targeting main. The rest target parent branches, so Closes #N in the description is silently ignored. The only way to link those PRs to their tracking issue is to open each one in the browser, click the gear icon, search for the issue, and click to confirm. Now multiply that by a 10-PR stack.
This is going to get worse. GitHub is shipping native stacked PRs in Q2 2026, and AI-assisted workflows (Claude Code, Copilot, etc.) can already create issues, set metadata, open PRs, and submit reviews through the API. But the moment a PR targets a non-default branch, the automation dead-ends and a human has to click buttons. More teams stacking, more agents managing PRs, and no API to connect them to issues.
You can programmatically set labels, milestones, assignees, projects, and sub-issues. But you can't link a PR to an issue. The UI already does it. Would you be open to bringing this back to the platform team with these use cases?
Same opinion here : we have a lot of manual noise doing the issue management into github : we cant rely issue to prs, and even if we do, this dont close the related issue.
there's no official GitHub API endpoint (neither REST nor GraphQL)
This has changed. addCloseIssueReferences and removeCloseIssueReferences GraphQL mutations were added on 2026-08-26. This means that gh api graphql can invoke them to add or remove linked issues for a pull request. I still believe --add-issue and --remove-issue are handy additions, though.
@babakks Would you mark this issue unblocked? If help is needed, I'm happy to contribute.
blockedenhancementa request to improve CLIgh-prrelating to the gh pr commandneeds-designAn engineering task needs design to proceedplatformProblems with the GitHub platform rather than the CLI client
Activity
github-actions commentedon Jul 29, 2025
Thank you for your issue! We have categorized it as a feature request, and it has been added to our backlog. In doing so, we are not committing to implementing this feature at this time, but, we will consider it for future releases based on community feedback and our own product roadmap.
Unless you see the help wantedContributions welcome
label, we are not currently looking for external contributions for this feature.
If you come across this issue and would like to see it implemented, please add a thumbs up! This will help us prioritize the feature. Please only comment if you have additional information or viewpoints to contribute.
babakks commentedon Jul 30, 2025
Thanks for your suggestion, @jeremy-langevin-twc! 🙏
Personally, I think this would be a valuable feature, but there's a problem here, and that's there's no official GitHub API endpoint (neither REST nor GraphQL) available for this purpose. The web front-end uses GUI-exclusive API endpoints that are not part of the official GitHub API. Therefore,
ghcannot (and should not) interact with them.That said, I'm going to bring this up internally and will update you here.
For now, I'll label this as blocked due to platform capabilities.
[-]```gh pr edit --add-issue <number>``` Add issue linking to prs[/-][+]Add issue linking to PRs via `gh pr edit --add-issue <number>` [/+]jeremy-langevin-twc commentedon Jul 30, 2025
Thank you for the update @babakks . I've been hoping for the feature for around a year now and thought it was about time to bring it up. I hope at some point this becomes available, as linking PRs to Issues is incredibly useful for tracking changes.
babakks commentedon Jul 31, 2025
I got an update from the platform team, and it confirms our observation that there's no API for linking. Also, there's no plan for supporting this through the API.
So, this issue remains blocked until the API supports the use case.
jeremy-langevin-twc commentedon Aug 14, 2025
Bummer, hope to see this change someday soon.
MantisClone commentedon Feb 17, 2026
@babakks thanks for checking with the platform team. Hit this today. Stacked PRs (Graphite, ghstack, etc.) only have one PR targeting
main. The rest target parent branches, soCloses #Nin the description is silently ignored. The only way to link those PRs to their tracking issue is to open each one in the browser, click the gear icon, search for the issue, and click to confirm. Now multiply that by a 10-PR stack.This is going to get worse. GitHub is shipping native stacked PRs in Q2 2026, and AI-assisted workflows (Claude Code, Copilot, etc.) can already create issues, set metadata, open PRs, and submit reviews through the API. But the moment a PR targets a non-default branch, the automation dead-ends and a human has to click buttons. More teams stacking, more agents managing PRs, and no API to connect them to issues.
You can programmatically set labels, milestones, assignees, projects, and sub-issues. But you can't link a PR to an issue. The UI already does it. Would you be open to bringing this back to the platform team with these use cases?
cherrianathomas17-art commentedon Feb 17, 2026
mickaelandrieu commentedon Apr 12, 2026
Same opinion here : we have a lot of manual noise doing the issue management into github : we cant rely issue to prs, and even if we do, this dont close the related issue.
I'm wondering if gitlab is better at it.
heloineto commentedon Jun 28, 2026
I also want this
LDWNS commentedon Jul 3, 2026
Also very interested!
feat(tasks): pr-metadata links the task's issue to the PR and gates m…
feat(tasks): link every PR to its task's issue and gate merges on it (#…
masaru-iritani commentedon Nov 6, 2026
This has changed.
addCloseIssueReferencesandremoveCloseIssueReferencesGraphQL mutations were added on 2026-08-26. This means thatgh api graphqlcan invoke them to add or remove linked issues for a pull request. I still believe--add-issueand--remove-issueare handy additions, though.@babakks Would you mark this issue unblocked? If help is needed, I'm happy to contribute.