-
Notifications
You must be signed in to change notification settings - Fork 8k
Description
Discussed in #5904
Originally posted by sfullerbeckman July 8, 2022
You know...
Have you used the "Add a suggestion" button when sumbmitting feedback to a PR? This allows reviewers to submit changes that can be committed directly to the PR branch. This is a great feature and can make it easier for users to collaborate on a PR and saves time, especially if a reviewer already knows how to fix an issue in the PR and can provide a commitable piece of code to the PR.
What if...
But what if we could submit changes to a PR through gh cli? Imagine checking out someone's code with gh pr checkout [pr number]. Then you could look at the person's PR in any IDE or text editor that you wish on your local machine. If you want to submit a suggestion, you would do so directly in your editor. These diff-able changes would be picked up by git of course. But instead of committing those changes directly to the person's PR (which you wouldn't want to do; your code is just a suggestion), you could run a command such as gh pr suggest [pr number]. The cli would pick up staged but uncommited changes and push them directly to the PR as a comment with "suggest changes" that could be directly applied to the PR.
How...
Essentially the process would be...
gh pr checkout [pr number]- Makes some changes to the code in your editor
git add -Agh pr suggest [pr number]
Why...
Two of the main benefits of a feature like this are as follows:
- Someone can do an entire review from their local machine on their own familiar editor: review code, add comments, submit suggestions, etc. No longer would you have to context switch between the browser and their local editor.
- By reviewing in the editor, you have all the build tools and static anlysis tools available to you inherantly. The reviewer would now have more confidence in the code he submits to the PR. He can confirm that the suggestion compiles and runs properly.
gh already gives you the ability to review and add comments to PRs. My suggested feature would streamline the proccess of reviewing and submitting suggestions to the PR.