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
enhancementa request to improve CLIgh-prrelating to the gh pr commandhelp wanted candidateIssue may be marked as help-wanted but not yet ready to accept PR
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.
Reacted by Seiya, Adrian, RADEN ARYA HERO JAVANES and Md. Yeasin Sheikh
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.
Reacted by Brent Westbrook, Seiya and Md. Yeasin Sheikh
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.
enhancementa request to improve CLIgh-prrelating to the gh pr commandhelp wanted candidateIssue may be marked as help-wanted but not yet ready to accept PR
Activity
williammartin commentedon Jun 16, 2025
This seems like it would be a very sensible edition. That said, the
issue/pr editcommands 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.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.ntBre commentedon Jun 16, 2025
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.
adrianveen commentedon Dec 4, 2025
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 thatgh pr createwill 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 editcommand. But still want to keep my support for the--editoroption flag.Add --editor flag to gh issue edit
Add `--editor` flag to `gh issue edit` and `gh pr edit`
Add `--editor` flag to `gh issue edit` and `gh pr edit`
Add `--editor` flag to `gh issue edit` and `gh pr edit`