GH-ISSUE-COMMENT(1)

πŸ’¬ gh-issue-comment(1) β€” the GitHub CLI manual, bestie edition ✨

okay so real talk: this is gh-issue-comment, straight out of the GitHub CLI manual, and it's literally the glow-up your issue threads have been waiting for. let's get into it 🫢


🌸 NAME 🌸

gh-issue-comment β€” bestie, it adds a comment to an issue. that's the whole vibe ✨


πŸŽ€ SYNOPSIS πŸŽ€

gh issue comment {<number> | <url>} [flags]

like, you point it at an issue β€” either by its <number> or its <url> β€” and then you sprinkle flags on top as needed πŸ’…


πŸ¦‹ DESCRIPTION πŸ¦‹

Add a comment to a GitHub issue. iconic behavior, no cap.

If you don't hand it body text or attachments through flags, the command will interactively prompt you for the comment text. so it's not just gonna post an empty comment and embarrass you in front of the whole repo 😭

Use --attach to upload an image or video. here's the cute part: if the body already references an attached file β€” like ![alt](./login.png) β€” that reference gets rewritten to point at the uploaded asset. slay. and any attached file the body doesn't reference just gets appended to the end of the comment, so nothing gets left behind πŸ’–

You can attach up to 50 files per command. that's a lot of screenshots, 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. if a reference already exists in the body, it keeps the alt text written there. video renders as a player and has no alt text, so it cannot be given any β€” that's just how it is, no notes πŸ’€


✨ OPTIONS ✨

  • --attach <file> β€” attach an image or video file, in the # format. you can repeat this flag to attach multiple files, up to 50 per command πŸŽ€
  • -b, --body <text> β€” the comment body text. the words themselves, right there on the command line πŸ’¬
  • -F, --body-file <file> β€” read body text from a file. use - to read from standard input, iykyk πŸ“
  • --create-if-none β€” create a new comment if no comments are found. heads up though: this can be used only with --edit-last ✨
  • --delete-last β€” delete the last comment of the current user. the undo button for your last post πŸ™ˆ
  • --edit-last β€” edit the last comment of the current user. rewrite your own lore, respectfully ✍️
  • -e, --editor β€” skip prompts and open the text editor to write the body in. for the girls who draft in vim πŸ’œ
  • -w, --web β€” open the web browser to write the comment. sometimes you just want the GUI, and that's valid 🌈
  • --yes β€” skip the delete confirmation prompt when --delete-last is provided. no take-backs, bestie πŸ‘‘

πŸ‘‘ OPTIONS INHERITED FROM PARENT COMMANDS πŸ‘‘

  • -R, --repo <[HOST/]OWNER/REPO> β€” select another repository using the [HOST/]OWNER/REPO format. pointing at a different repo, no big deal 🌟

πŸ’€ EXIT CODES πŸ’€

vibe check on how it went:

  • 0 β€” Successful execution. ate, left no crumbs πŸ’…
  • 1 β€” Error. it's giving something went wrong 😭
  • 2 β€” Command canceled. you backed out, and that's okay 🫢
  • 4 β€” Authentication required. log in first, bestie πŸ”
NOTE: Specific commands may have additional exit codes. Refer to the command's help for more information.

🌸 EXAMPLE 🌸

# Add a comment to an issue
$ gh issue comment 12 --body "Hi from GitHub CLI"

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

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

the three moods: just text, one screenshot with alt text, and the before/after glow-up 😌✨


🧚 SEE ALSO 🧚

  • gh-issue(1) β€” the parent command, the main character

okay that's the whole page!! this was GitHub CLI v2.102.0, dated Oct 2026 β€” mwah, go comment on some issues, bestie πŸ’–πŸŽ€πŸ¦‹

πŸ“¦ where this page comes from