docs(pr edit): improve command examples with grouped sections

Add comment headers to group examples by concern (title/body, labels,
reviewers, assignees, projects/milestones), matching the style used by
other commands like pr review and repo create. Also adds examples for
--body-file and re-requesting review via --add-reviewer.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
This commit is contained in:
Kynan Ware 2026-03-24 09:20:08 -06:00
parent b9439afa78
commit 84050fbbad

View file

@ -74,12 +74,31 @@ func NewCmdEdit(f *cmdutil.Factory, runF func(*EditOptions) error) *cobra.Comman
- %[1]s@copilot%[1]s: request or remove review from Copilot (not supported on GitHub Enterprise Server)
`, "`"),
Example: heredoc.Doc(`
# Edit the title and body of a pull request
$ gh pr edit 23 --title "I found a bug" --body "Nothing works"
# Use a file as the body
$ gh pr edit 23 --body-file body.txt
# Manage labels
$ gh pr edit 23 --add-label "bug,help wanted" --remove-label "core"
$ gh pr edit 23 --add-reviewer monalisa,hubot --remove-reviewer myorg/team-name
# Manage reviewers
$ gh pr edit 23 --add-reviewer monalisa,hubot --remove-reviewer myorg/team-name
# Re-request review
$ gh pr edit 23 --add-reviewer monalisa
# Request a review from GitHub Copilot
$ gh pr edit 23 --add-reviewer "@copilot"
# Manage assignees
$ gh pr edit 23 --add-assignee "@me" --remove-assignee monalisa,hubot
# Assign GitHub Copilot
$ gh pr edit 23 --add-assignee "@copilot"
# Manage projects and milestones
$ gh pr edit 23 --add-project "Roadmap" --remove-project v1,v2
$ gh pr edit 23 --milestone "Version 1"
$ gh pr edit 23 --remove-milestone