GH-PR-COMMENT(1)

πŸ’¬ gh-pr-comment β€” the manual page, bestie edition

okay so gh-pr-comment is literally just the GitHub CLI manual entry for dropping a comment on a pull request. that's the whole vibe. let's get into it 🫢


✨ NAME ✨

gh-pr-comment β€” add a comment to a pull request πŸ’…


🌸 SYNOPSIS 🌸

gh pr comment [<number> | <url> | <branch>] [flags]

like, you point it at a PR (by number, url, or branch, or honestly nothing at all) and it comments. iconic behavior.


πŸ¦‹ DESCRIPTION πŸ¦‹

So the whole point: add a comment to a GitHub pull request. that's it. that's the gig πŸŽ€

If you don't hand it any body text or attachments through flags, the command will interactively prompt you for the comment text. it's not gonna just guess, bestie 😭

Use --attach to upload an image or video. and here's the tea β€” if the body already references an attached file, like ![alt](./login.png), that reference gets rewritten to point at the uploaded asset. slay. any attached file the body does not reference gets appended to the end of the comment. and you can attach up to 50 files per command. fifty. go off πŸ‘‘

Alt text for an image follows the path after #, as in --attach './login.png#The login error state'. Without it, the filename is used. A reference already in the body keeps the alt text written there. Video renders as a player and has no alt text, so it cannot be given any β€” sorry to the video alt-text girlies, it's just not a thing πŸ™ˆ


⭐ OPTIONS ⭐

  • --attach <file> β€” attach an image or video file, in # format πŸ“Ž
  • -b, --body <text> β€” the comment body text, aka the actual words
  • -F, --body-file <file> β€” read body text from a file (use "-" to read from standard input) πŸ“
  • --create-if-none β€” create a new comment if no comments are found. can be used only with --edit-last ⚠️
  • --delete-last β€” delete the last comment of the current user πŸ’€
  • --edit-last β€” edit the last comment of the current user ✏️
  • -e, --editor β€” skip prompts and open the text editor to write the body in
  • -w, --web β€” open the web browser to write the comment 🌈
  • --yes β€” skip the delete confirmation prompt when --delete-last is provided βœ…

πŸ’œ OPTIONS INHERITED FROM PARENT COMMANDS πŸ’œ

  • -R, --repo <[HOST/]OWNER/REPO> β€” select another repository using the [HOST/]OWNER/REPO format 🧚

πŸ”₯ EXIT CODES πŸ”₯

  • 0: Successful execution ✨
  • 1: Error 😭
  • 2: Command canceled
  • 4: Authentication required πŸ”
NOTE: Specific commands may have additional exit codes. Refer to the command's help for more information. fr fr, check the help πŸ’…

🌸 EXAMPLE 🌸

# Add a comment to a pull request
$ gh pr comment 13 --body "Hi from GitHub CLI"

# Attach a screenshot, with alt text after "#"
$ gh pr comment 13 --attach './login.png#The login error state'

# Attach multiple files by repeating the flag
$ gh pr comment 13 --attach ./before.png --attach ./after.png

πŸŽ€ SEE ALSO πŸŽ€

gh-pr(1) β€” go read that one too, iykyk 🫢


kay that's the whole page babes β€” this was the GitHub CLI manual, version v2.102.0, dated Oct 2026. mwah, go comment on something πŸ’–

πŸ“¦ where this page comes from