Skip to content

Add pr edit --editor #11108

Open
Open

Description

@ntBre

Describe the feature or problem you’d like to solve

I would love to be able to retrieve the current PR body and open it in my system editor, pushing back the final version when I save and quit.

Proposed solution

Add an -e/--editor flag to pr edit (and possibly issue edit) to mirror the same option for pr create (and issue create).

Additional context

This is possibly more of a question, or I may have missed an existing issue, but I found #390 (comment), #9310, and #9433, but no corresponding issue/PR for the edit versions.

Activity

  1. added
    enhancement
    on Jun 12, 2025
  2. added
    needs-triage
    on Jun 12, 2025
  3. added
    gh-pr
    on Jun 16, 2025
  4. williammartin commented on Jun 16, 2025

    @williammartin
    Member

    This seems like it would be a very sensible edition. That said, the issue/pr edit commands are already pretty hard to maintain, so I'm not sure that we're likely to prioritise this work particularly soon without more people chiming in, or until we get round to tackling some of the debt there. Hope that makes sense.

    That said, I can offer you a handy dandy alias in the meantime that will grab the body, open it in a tmpfile and then put that back into --body-file.

    ➜  gh alias set pr-edit-body --shell 'tmpfile=$(mktemp) && gh pr view "${1}" --json body -q .body > "$tmpfile" && ${EDITOR:-vi} "$tmpfile" && gh pr edit "${2}" --body-file "$tmpfile"'
    
    - Creating alias for pr-edit-body: !tmpfile=$(mktemp) && gh pr view "${1}" --json body -q .body > "$tmpfile" && ${EDITOR:-vi} "$tmpfile" && gh pr edit "${2}" --body-file "$tmpfile"
    ✓ Added alias pr-edit-body
    
    ➜ gh pr-edit-body 11105
    https://github.com/cli/cli/pull/11105
    

    If that's not good enough for you and you REALLY, REALLY want us to get this into pr edit, do let me know. It's good to help us make plans. Cheers.

  5. added
    more-info-needed
    on Jun 16, 2025
  6. ntBre commented on Jun 16, 2025

    @ntBre
    Author

    Thanks for the response, that totally makes sense! And thanks for the cool alias!

    If I decide I REALLY, REALLY want it (😄) I'd be happy to work on a PR too, so I don't think you need to prioritize it at all.

  7. removed
    more-info-needed
    on Jun 18, 2025
  8. adrianveen commented on Dec 4, 2025

    @adrianveen

    Want to add in that I would love for this to be added - in fact i assumed it already was and expected an interactive mode to prompt me to open my editor when using gh pr edit #, similar to the way that gh pr create will ask about an editor without any arguments passed.

    This is is great if you are using PR templates and it would be impractical to edit them from the CLI.

    edit: Looks like the interactive mode that I was thinking of already exists -- i was misusing the pr edit command. But still want to keep my support for the --editor option flag.

  9. added
    help wanted candidate
    and removed
    needs-triage
    on Dec 8, 2025
  10. added 2 commits that reference this issue on Mar 15, 2026
    4312fc0
    81f678f
  11. added a commit that references this issue on Mar 25, 2026
    7ea57f9
  12. added a commit that references this issue on Jun 30, 2026
    3e87c14
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

    enhancementgh-prhelp wanted candidate

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions