You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Describe the feature or problem you’d like to solve
PRs have a really nice way of leaving approvals, change requests, comments, and marking comments as resolved. gh cli does not appear to support comments on PRs
Proposed solution
CLI could allow commenting on a commit, filename, and line number, and it could allow retrieving all comments on all changes in a commit.
this is on our roadmap! but we hadn't opened an issue for it yet, so thank you~
we wanted to do some designs up front and see what made the most sense; we only have some hand-drawn prototypes so far.
personally i was interested in something kind of like git add -p where you could page through comments/suggestions and take an action on each one. i'm curious what people think about that level of interactivity.
Reacted by Chad Furman, zeshan, Kevin Anantha, Roberto Dip, Andreas Nel, Åsmund Ødegård, nyxtom, silby, alex zhang, Christian Doczkal and 9 more
We've experimented with various flavors of this. For awhile we used git appraise, which has a CLI along the lines described by OP. We found it basically unusable, to the point where it was having a chilling effect on code review.
I prototyped a frontend which allowed you mark up a diff to leave comments, and that seemed fairly promising. The workflow ends up being similar to a the format-patch + email review workflow, except you do it all locally. The syntax I arrived on was using '>' as a prefix character for new comments, and something else (don't remember) for putting existing comments inside the patch, in context.
The only real issue I had was that emacs tries to be helpful with edited patch files to the point of breaking them when you try to add comment metadata. A derived mode to disable this feature fixed it.
Ultimately we chose to go back to github PR's rather than try to tool our way around it. The reason we were using it in the first place is because it gave us a way to digitally sign review comments; this would be a very attractive feature of any CLI-driven review workflow.
(also: Hi Nate! Thanks for making something great!)
Interactivity is nice but not needed for MVP. JetBrains etc can provide the interactivity using the cli hooks I'd suspect. Interactivity is a good v2 feature though I think
Reacted by Matheus de Mello Queiroz and chrismaherhbo
I prototyped a frontend which allowed you mark up a diff to leave comments, and that seemed fairly promising. The workflow ends up being similar to a the format-patch + email review workflow, except you do it all locally. The syntax I arrived on was using '>' as a prefix character for new comments, and something else (don't remember) for putting existing comments inside the patch, in context.
What about the reverse? Quote the entire patch file, and have people insert their comments without the quote marks. That will be familiar for anyone used to reviewing patches by email, and the > prefix on every line should prevent editors from attempting to fiddle with the patch.
Reacted by silby, Michael Drake, lincolnzzz529-wq and InterLinked1
I've renamed this as we have since added gh pr review (pending release) for adding a top level approve, request changes, or comment review on a given pr.
However, we did not include an affordance for line comments.
I find it at least medium usable. It has a workflow that's half add -p inspired, but mostly uses a modified diff format that allows you to leave inline comments, right from an ordinary git diff that's available in a buffer.
Please feel free to take ideas from that project if you find it appealing!
Reacted by Roberto Dip, Furkan Üzümcü and collinalexbell
Reacted by Nate Smith, Roberto Dip and collinalexbell
What about the reverse? Quote the entire patch file, and have people insert their comments without the quote marks. That will be familiar for anyone used to reviewing patches by email, and the > prefix on every line should prevent editors from attempting to fiddle with the patch.
I find it at least medium usable. It has a workflow that's half add -p inspired, but mostly uses a modified diff format that allows you to leave inline comments, right from an ordinary git diff that's available in a buffer.
Please feel free to take ideas from that project if you find it appealing!
What about an option take a diff (e.g., the current local changes) and open the GitHub website with an in-progress review where the diffs have been turned into suggestions, so that one can edit it there and add comments to the proposed changes? Currently, I often find my self editing code locally and then copying the changes manually into the web interface.
Been review a lot of code lately. Browser sometime just struggles to render all the files. And even with the new navigation tool, still tricky to jump around files.
My ideal workflow:
gh pr review --diff #1
view diff in vim
a plugin action to run file.viewed
a plugin action to comment on current line in a split window.
a plugin action to review all comments and submit review
Reacted by Pendar and Connor Ford
Reacted by Stephan Schroevers, Pendar and Dmitry Petrov
I ran into this while trying to automate PR code review from GitHub Actions. The goal was to create inline review comments on specific changed lines/ranges, similar to what GitHub's review UI supports.
Current gh behavior
With gh 2.83.2, gh pr review appears to support only review-level actions:
--approve
--comment
--request-changes
--body / --body-file
I could not find a native high-level way to provide path, line, side, start_line, or position to gh pr review for inline review comments.
Request
A native command such as one of these would be very useful:
This creates a submitted PR review object with grouped inline comments on the changed lines.
Update 2026-05-08 - Direct comment endpoint also works
After the GitHub incident mentioned in #13358 was resolved, I re-tested the direct pull request comments endpoint and it now works too. These gh api approaches created inline comments successfully:
gh api repos/OWNER/REPO/pulls/PULL_NUMBER/comments \
--method POST \
-f body='Inline comment body' \
-f commit_id='<HEAD_SHA>' \
-f path='path/to/file.ts' \
-F position=10
So the REST API workaround is viable both for creating a submitted review with grouped inline comments (/reviews) and for creating individual inline comments (/comments). Native gh pr review / gh pr comment support would still be useful because the CLI could resolve the PR head SHA and diff coordinates automatically.
Reacted by Masafumi Koba, Ryan Kelly, Paul Debus, John Starich, Cristian Oliveira, Patrick Moor, Gabriel Lanata and Martin Ashby
Activity
vilmibm commentedon Feb 12, 2020
this is on our roadmap! but we hadn't opened an issue for it yet, so thank you~
we wanted to do some designs up front and see what made the most sense; we only have some hand-drawn prototypes so far.
personally i was interested in something kind of like
git add -pwhere you could page through comments/suggestions and take an action on each one. i'm curious what people think about that level of interactivity.mullr commentedon Feb 12, 2020
We've experimented with various flavors of this. For awhile we used git appraise, which has a CLI along the lines described by OP. We found it basically unusable, to the point where it was having a chilling effect on code review.
I prototyped a frontend which allowed you mark up a diff to leave comments, and that seemed fairly promising. The workflow ends up being similar to a the format-patch + email review workflow, except you do it all locally. The syntax I arrived on was using '>' as a prefix character for new comments, and something else (don't remember) for putting existing comments inside the patch, in context.
The only real issue I had was that emacs tries to be helpful with edited patch files to the point of breaking them when you try to add comment metadata. A derived mode to disable this feature fixed it.
Ultimately we chose to go back to github PR's rather than try to tool our way around it. The reason we were using it in the first place is because it gave us a way to digitally sign review comments; this would be a very attractive feature of any CLI-driven review workflow.
(also: Hi Nate! Thanks for making something great!)
chadfurman commentedon Feb 12, 2020
Interactivity is nice but not needed for MVP. JetBrains etc can provide the interactivity using the cli hooks I'd suspect. Interactivity is a good v2 feature though I think
joshtriplett commentedon Feb 12, 2020
What about the reverse? Quote the entire patch file, and have people insert their comments without the quote marks. That will be familiar for anyone used to reviewing patches by email, and the
>prefix on every line should prevent editors from attempting to fiddle with the patch.[-]Code Review Support[/-][+]Fine Grained Code Review Support[/+]vilmibm commentedon May 14, 2020
I've renamed this as we have since added
gh pr review(pending release) for adding a top level approve, request changes, or comment review on a given pr.However, we did not include an affordance for line comments.
jordanlewis commentedon Jun 6, 2020
Hey @vilmibm, stumbled across this issue after realizing that
ghis getting improvements - awesome!I just wanted to point out a project I made a while back called
rethat has a workflow for line by line review comments:https://github.com/jordanlewis/re
I find it at least medium usable. It has a workflow that's half
add -pinspired, but mostly uses a modifieddiffformat that allows you to leave inline comments, right from an ordinarygit diffthat's available in a buffer.Please feel free to take ideas from that project if you find it appealing!
silby commentedon Apr 23, 2021
I strongly cosign this suggestion!
collinalexbell commentedon Jul 21, 2021
Thanks
chdoc commentedon Sep 12, 2021
What about an option take a diff (e.g., the current local changes) and open the GitHub website with an in-progress review where the diffs have been turned into suggestions, so that one can edit it there and add comments to the proposed changes? Currently, I often find my self editing code locally and then copying the changes manually into the web interface.
jackieli-tes commentedon Mar 30, 2022
Been review a lot of code lately. Browser sometime just struggles to render all the files. And even with the new navigation tool, still tricky to jump around files.
My ideal workflow:
gh pr review --diff #1file.viewedsamcoe commentedon Apr 2, 2022
@jackieli-tes If you are using neovim I can recommend https://github.com/pwntester/octo.nvim which is a plugin that is powered by
gh.jackieli-tes commentedon Apr 2, 2022
it look awesome! am definitely giving it a try.
13 remaining items
gh prfor inline comments and review flows (AI agent use cases) #12232 as a duplicate of this issueBenkovichnikita commentedon Dec 7, 2025
@chadfurman @adonh @silicakes @pppp606 @kesar @mislav @mullr @jordanlewis @vilmibm @silby @joshtriplett @danobi
We have implemented extension https://github.com/agynio/gh-pr-review. Feel free to use and share if you need anything!
Command to install: gh extension install Agynio/gh-pr-review
Paper: https://agyn.io/blog/gh-pr-review-cli-agent-workflows
SergiuSavva commentedon Apr 5, 2026
I opened #12396, which was closed as a duplicate of this issue, so I’m adding the concrete CLI proposal here.
My main use case is adding inline PR comments without dropping to gh api or the web UI.
Proposed UX:
gh pr comment 123 --body "Consider optional chaining here" --path "src/utils.ts" --line 42Possible flags:
• --path / -p: file path in the diff
• --line / -L: line number or range
• --side / -s: LEFT or RIGHT, default RIGHT
The key DX improvement would be auto-resolving the PR head commit SHA, so users do not need to look it up manually.
More details can be founded here #12396
feat: add --author, --all, and --commit flags for agent triage workflows
RyanJarv commentedon Apr 16, 2026
This would be extremely helpful for understanding PRs written by AI coding agents.
Benkovichnikita commentedon Apr 25, 2026
@SergiuSavva take a look on https://github.com/agynio/gh-pr-review, we made an extension for
ghwhere you can add inline PR commentsxoelop commentedon May 6, 2026
Use case
I ran into this while trying to automate PR code review from GitHub Actions. The goal was to create inline review comments on specific changed lines/ranges, similar to what GitHub's review UI supports.
Current
ghbehaviorWith
gh2.83.2,gh pr reviewappears to support only review-level actions:--approve--comment--request-changes--body/--body-fileI could not find a native high-level way to provide
path,line,side,start_line, orpositiontogh pr reviewfor inline review comments.Request
A native command such as one of these would be very useful:
Ideally it would support:
Update 2026-05-07 - Working workaround
I found a working way to create inline PR review comments with
gh apiwith the pull request reviews endpoint:Where
/tmp/review.jsonincludes:{ "commit_id": "<HEAD_SHA>", "event": "COMMENT", "body": "Review body", "comments": [ { "path": "path/to/file.ts", "line": 42, "side": "RIGHT", "body": "Inline comment body" } ] }This creates a submitted PR review object with grouped inline comments on the changed lines.
Update 2026-05-08 - Direct comment endpoint also works
After the GitHub incident mentioned in #13358 was resolved, I re-tested the direct pull request comments endpoint and it now works too. These
gh apiapproaches created inline comments successfully:Single-line inline comment:
Multi-line range comment:
Legacy diff-position comment also worked:
So the REST API workaround is viable both for creating a submitted review with grouped inline comments (
/reviews) and for creating individual inline comments (/comments). Nativegh pr review/gh pr commentsupport would still be useful because the CLI could resolve the PR head SHA and diff coordinates automatically.gh pr view#14237 as a duplicate of this issue