Visitar URL original
Add `gh pr share` command · Issue #14618 · cli/cli · GitHub
Skip to content

Add gh pr share command #14618

Open
Open

Description

@edjeffreys

Describe the feature or problem you’d like to solve

Sharing pull requests to colleagues/teams/foo/bar currently involves navigating manually to github, copy-pasting the url and sharing. The URL has no context or useful information as it stands.

My org, and I, have custom scripts to take the PR and create a more useful markdown message including:

  • PR title
  • PR line count diff
  • Repo

I think gh cli would benefit from enabling this as a pr command.

Proposed solution

gh pr share [pr number] [--format=[url|markdown]]

A new PR command to share either a url, or markdown message for the given PR to either STDOUT or copy to clipboard.

Additionally, support for user to create a template to personalise markdown message (perhaps adding emojis and the likes in contents that might be slack-workspace specific...)

Additional context

Draft PR here:
Add gh pr share command (+457/-0)
edjeffreys/gh-cli

Activity

  1. cli-triage commented on Oct 7, 2026

    @cli-triage

    Thanks for the suggestion! I'm suggesting enhancement since this is a clear, well-described feature request (new gh pr share subcommand with a defined syntax, rationale, and even a draft implementation linked), and gh-pr since it targets the pr command family. No duplicate issues were found in cli/cli after searching for related terms like "share", "markdown format", and "clipboard".

    Generated by Issue Triage (skills-driven) for #14618 · copilot · auto · 20.4 AIC · ⌖ 2.21 AIC · ⊞ 11K · ◷

  2. github-actions commented on Oct 7, 2026

    @github-actions
    Contributor

    Thank you for your issue! We have categorized it as an enhancement (feature or improvement) 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. williammartin commented on Oct 7, 2026

    @williammartin
    Member

    Hey @edjeffreys, thanks for the request and the PR for evidence. Often when we get a request like this, that is mostly targeted for a user or org's workflow we suggest creating an extension and seeing whether it gets any kind of traction.

    Do you find you would use the pr_share_template option yourselves? Trying to imagine when your org would want the default to differ. Cheers.

  4. williammartin commented on Oct 7, 2026

    @williammartin
    Member

    I know you have your own scripts but FWIW if anyone else comes across this, a simplified form can be achieved with:

    gh alias set --clobber share-pr 'pr view --json title,url,additions,deletions --template "{{printf \"[%s](%s) (+%.0f/-%.0f)\" .title .url .additions .deletions}}"'
    
    ➜ gh share-pr https://github.com/cli/go-gh/pull/274 | cat
    [fix: refresh repository identity after SSH translation](https://github.com/cli/go-gh/pull/274) (+84/-8)%
    
  5. edjeffreys commented on Oct 7, 2026

    @edjeffreys
    Author

    Hey @edjeffreys, thanks for the request and the PR for evidence. Often when we get a request like this, that is mostly targeted for a user or org's workflow we suggest creating an extension and seeing whether it gets any kind of traction.

    Do you find you would use the pr_share_template option yourselves? Trying to imagine when your org would want the default to differ. Cheers.

    Yeah that was the thinking - mainly for org to chuck a template on dev machines.

    I know you have your own scripts but FWIW if anyone else comes across this, a simplified form can be achieved with:

    gh alias set --clobber share-pr 'pr view --json title,url,additions,deletions --template "{{printf \"[%s](%s) (+%.0f/-%.0f)\" .title .url .additions .deletions}}"'
    
    ➜ gh share-pr https://github.com/cli/go-gh/pull/274 | cat
    [fix: refresh repository identity after SSH translation](https://github.com/cli/go-gh/pull/274) (+84/-8)%
    

    I hadn't even considered that; will give that a whirl :)

  6. williammartin commented on Oct 7, 2026

    @williammartin
    Member

    At least while its in your org and you already have your own desired template, and you just want a way to centrally manage that, you could do something like:

    ➜  gh extension install williammartin/gh-share-pr
    ✓ Installed extension williammartin/gh-share-pr
    
    ➜  gh share-pr https://github.com/cli/go-gh/pull/274 // this also copies to clipboard
    [fix: refresh repository identity after SSH translation](https://github.com/cli/go-gh/pull/274) in cli/go-gh (+84/-8)

    You can find and just take the code at https://github.com/williammartin/gh-share-pr, it's 100% vibe coded, just wanted to share another ground between an alias and a core command.

  7. edjeffreys commented on Oct 8, 2026

    @edjeffreys
    Author

    At least while its in your org and you already have your own desired template, and you just want a way to centrally manage that, you could do something like:

    ➜ gh extension install williammartin/gh-share-pr
    ✓ Installed extension williammartin/gh-share-pr

    ➜ gh share-pr cli/go-gh#274 // this also copies to clipboard
    fix: refresh repository identity after SSH translation in cli/go-gh (+84/-8)
    You can find and just take the code at https://github.com/williammartin/gh-share-pr, it's 100% vibe coded, just wanted to share another ground between an alias and a core command.

    Ha yep, already done that :) https://github.com/edjeffreys/gh-share

    Thanks William!

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

    enhancementa request to improve CLIgh-prrelating to the gh pr command

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions