gh-pr-comment
Comment on GitHub pull requests
TLDR
Comment on the pull request of the current branch
Comment on a specific pull request
Comment from a file
Open the editor to write a multi-line comment
SYNOPSIS
gh pr comment [number | url | branch] [--body TEXT] [--body-file FILE] [--edit-last] [-R, --repo [HOST/]OWNER/REPO]
PARAMETERS
--body=
The text to use as the body for the comment. Reads from stdin if omitted and no --body-file.
--body-file=
Read comment body from the specified file (use "-" for stdin).
--edit-last
Edit the last comment made by the authenticated user on the PR.
-R, --repo=[
Operate on a specific repository using HOST/OWNER/REPO format.
DESCRIPTION
The gh pr comment command is part of the GitHub CLI toolset, allowing users to add, edit, or reply to comments on pull requests (PRs) directly from the command line. It streamlines GitHub workflows by enabling quick feedback without leaving the terminal.
Use it to post general comments on a PR, edit your previous comment, or provide inline feedback using diff hunk syntax. Specify a PR by number, URL, branch name, or omit for the current branch's PR. The comment body can be provided inline, via stdin, or from a file.
This command requires authentication via gh auth login. It's ideal for CI/CD pipelines, code reviews, and automating responses. Supports repository overrides for cross-repo operations.
CAVEATS
Requires GitHub CLI authentication (gh auth login). Cannot edit others' comments. Inline file comments use special @@ syntax in body. No direct support for threading replies without review context.
EXAMPLES
gh pr comment 123 --body "Great work!"
gh pr comment --body-file review.md
gh pr comment --edit-last
echo 'LGTM' | gh pr comment
HISTORY
Introduced in GitHub CLI v0.5.0 (Feb 2020). Enhanced with --edit-last in v1.0.0 (2021) and repo overrides in later releases. Actively maintained by GitHub.
SEE ALSO
gh(1), gh-pr-view(1), gh-pr-review(1), gh-issue-comment(1)


