GH-DISCUSSION-VIEW(1)

πŸ’… gh-discussion-view β€” GitHub CLI manual, bestie edition ✨

okay so real talk, this one is a whole vibe: gh-discussion-view β€” View a discussion (preview). yes it says preview, meaning it's still in its soft-launch era, so be nice to it 🫢


🌸 SYNOPSIS 🌸

gh discussion view {<number> | <discussion-url> | <comment-id> |
<comment-url>} [flags]

like, you just hand it one of those four things and it does its thing πŸ’…


✨ DESCRIPTION ✨

So what it does: it pulls up the title, the body, and all the other lil info about a discussion. Iconic. ✨

Wanna see the comments too? You gotta pass --comments, ok? Otherwise you're just getting the main character post with no replies. And ngl, a few of the latest replies of each comment will also be retrieved regardless of the selected ordering β€” so you're always getting a lil taste of the newest stuff no matter what order you asked for πŸ“

Now, if you want the full reply thread of one single comment? Different move entirely: pass a comment node ID or a comment URL as the argument instead of a discussion. Like this: https://github.com/OWNER/REPO/discussions/123#discussioncomment-456 β€” that's the one, iykyk πŸ”₯

Pagination and ordering are yours to control via --order, --limit, and --after. Go off, queen πŸ‘‘

And if you'd rather just yassify your browser β€” use --web to open the discussion or comment in a web browser instead. no terminal needed, we're being ✨visual✨ today.


πŸŽ€ OPTIONS πŸŽ€

  • --after <string> β€” cursor for the next page. like a bookmark for your next scroll, fr.
  • -c, --comments β€” view discussion comments. this is the one you want if you actually want the tea β˜•
  • -q, --jq <expression> β€” filter JSON output using a jq expression. chef's kiss for scripting besties.
  • --json <fields> β€” output JSON with the specified fields. (see the JSON FIELDS section below, we got you πŸ’–)
  • -L, --limit <int> (default 30) β€” maximum number of comments or replies to fetch. default's 30, so that's your starting point ✨
  • --order <string> (default "newest") β€” order of comments or replies: {oldest|newest}. defaults to "newest" so you see the fresh stuff first 🌈
  • -R, --repo <[HOST/]OWNER/REPO> β€” select another repository using the [HOST/]OWNER/REPO format. repo-hopping? valid.
  • -t, --template <string> β€” format JSON output using a Go template; see gh help formatting. customise to your heart's content πŸŽ€
  • -w, --web β€” open a discussion in the browser. main character energy, browser edition πŸ‘‘

πŸ¦‹ JSON FIELDS πŸ¦‹

here's the full roster, no gatekeeping, all of them, slay:

answerChosenAt, answerChosenBy, answered, author, body, category, closed, closedAt, comments, createdAt, id, labels, locked, number, reactionGroups, state, stateReason, title, updatedAt, url


πŸ’€ EXIT CODES πŸ’€

bestie, read these so you know what just happened:

  • 0: Successful execution β€” we ate πŸ’…
  • 1: Error β€” it's giving oops 😭
  • 2: Command canceled β€” you backed out, no judgement πŸ™ˆ
  • 4: Authentication required β€” you gotta log in first, love, gh auth login hours 🫢
NOTE: Specific commands may have additional exit codes. Refer to the command's help for more information. (iykyk, always check the help ✨)

🧚 EXAMPLE 🧚

copy these exactly, they're literally free:

# View a discussion by number
$ gh discussion view 123

# View a discussion by URL
$ gh discussion view https://github.com/OWNER/REPO/discussions/123

# View with comments
$ gh discussion view 123 --comments

# View with oldest comments first
$ gh discussion view 123 --comments --order oldest

# Limit to 10 comments
$ gh discussion view 123 --comments --limit 10

# Fetch the next page of comments
$ gh discussion view 123 --comments --after CURSOR

# View the reply thread of a comment by node ID
$ gh discussion view DC_abc123

# View the reply thread of a comment by URL
$ gh discussion view 'https://github.com/OWNER/REPO/discussions/123#discussioncomment-456'

# Paginate through replies
$ gh discussion view DC_abc123 --limit 10 --after CURSOR

# Open in browser
$ gh discussion view 123 --web

🌟 SEE ALSO 🌟


okay that's the whole page, you're officially fluent πŸŽ“πŸ’œ

GitHub CLI v2.102.0 Β· Oct 2026 β€” mwah, love u, go view some discussions πŸ’‹πŸŽ€

πŸ“¦ where this page comes from