New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Submit a suggested change to a PR from the Github CLI #5905
Comments
This idea is very intriguing! After discussing internally we have a few thoughts.
We'd love to see a spike/prototype around this idea and one of us might even pick it up for a hack day, but until it's a more holistic solution to PR reviewing overall we're hesitant to guarantee that we'd merge this kind of feature. I marked it as |
I'd love to see this, even as an extension to start. One potential problem that I see with translating local changes to suggested changes is: what would happen with local changes that edit parts of the code that weren't present in the original diff of the PR? As far as I know, one can only suggest changes in areas of the code that the original PR has edited. |
@mislav, Isn't that going to change soon though? I saw that commenting on lines that weren't changed in the PR is going to be implemented soon. #347 |
@vilmibm, addressing your first comment, we could easily add a non-suggestion comment feature to the gh cli. And referring to you second comment, it seems to me that whenever the user chooses to submit the suggested changes on his local machine, it would reset the branch's head back to the tip, removing all the suggested changes that were added. This would keep the state clean. |
I'd also love to see this. Similarly, I'd like to be able to link comments, without suggestions, to specific lines in specific files. Something like |
Seems like there is a lot of interest for this feature from the discussion post. If anyone has any free time (I do not), I'd love to see a PR mocking out this idea. Maybe if we can demonstrate its feasibility, Github will invest some resources to build it out. |
I would really like to have this functionality to improve the first-time contributor experience. Here is an example workflow:
|
It looks like non-suggestion comments, as well as reviews, are possible via the CLI now. It would be nice to be able to do the same with suggestions. |
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 asgh 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]
git add -A
gh pr suggest [pr number]
Why...
Two of the main benefits of a feature like this are as follows:
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.
The text was updated successfully, but these errors were encountered: