gh discussion view
gh discussion view {<number> | <discussion-url> | <comment-id> | <comment-url>} [flags]
Display the title, body, and other information about a discussion.
To see the comments on a discussion, pass --comments. A few latest replies
of each comment will also be retrieved regardless of the selected ordering.
To see the full reply thread of a single comment, pass a comment node ID or
comment URL as the argument instead of a discussion
(e.g., https://github.com/OWNER/REPO/discussions/123#discussioncomment-456).
Pagination and ordering can be controlled via --order, --limit, and --after flags.
Use --web to open the discussion or comment in a web browser instead.
Options
-
--after <string> - Cursor for the next page
-c,--comments- View discussion comments
-q,--jq <expression>- Filter JSON output using a jq expression
-
--json <fields> - Output JSON with the specified fields
-L,--limit <int> (default 30)- Maximum number of comments or replies to fetch
-
--order <string> (default "newest") - Order of comments or replies: {oldest|newest}
-R,--repo <[HOST/]OWNER/REPO>- Select another repository using the [HOST/]OWNER/REPO format
-t,--template <string>- Format JSON output using a Go template; see "gh help formatting"
-w,--web- Open a discussion in the browser
JSON Fields
answerChosenAt, answerChosenBy, answered, author, body, category, closed, closedAt, comments, createdAt, id, labels, locked, number, reactionGroups, state, stateReason, title, updatedAt, url
Examples
# 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