Skip to content

Add issue linking to PRs via gh pr edit --add-issue <number>  #11405

Open

Description

@jeremy-langevin-twc

Add linking of an Issue to a PR via the CLI

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:
Image

Activity

  1. added
    enhancement
    on Jul 29, 2025
  2. github-actions commented on Jul 29, 2025

    @github-actions
    Contributor

    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 wanted Contributions 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.

  3. added
    needs-triage
    on Jul 29, 2025
  4. babakks commented on Jul 30, 2025

    @babakks
    Member

    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, 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.

  5. added
    platform
    gh-pr
    on Jul 30, 2025
  6. changed the title [-]```gh pr edit --add-issue <number>``` Add issue linking to prs[/-] [+]Add issue linking to PRs via `gh pr edit --add-issue <number>` [/+] on Jul 30, 2025
  7. jeremy-langevin-twc commented on Jul 30, 2025

    @jeremy-langevin-twc
    Author

    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.

  8. babakks commented on Jul 31, 2025

    @babakks
    Member

    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.

  9. added
    needs-design
    and removed
    needs-triage
    on Aug 11, 2025
  10. jeremy-langevin-twc commented on Aug 14, 2025

    @jeremy-langevin-twc
    Author

    Bummer, hope to see this change someday soon.

  11. MantisClone commented on Feb 17, 2026

    @MantisClone

    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?

  12. cherrianathomas17-art commented on Feb 17, 2026

    @cherrianathomas17-art
  13. mickaelandrieu commented on Apr 12, 2026

    @mickaelandrieu

    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.

  14. heloineto commented on Jun 28, 2026

    @heloineto

    I also want this

  15. LDWNS commented on Jul 3, 2026

    @LDWNS

    Also very interested!

  16. masaru-iritani commented on Nov 6, 2026

    @masaru-iritani

    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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    blockedenhancementgh-prneeds-designplatform

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions