DEV Community ๐Ÿ‘ฉโ€๐Ÿ’ป๐Ÿ‘จโ€๐Ÿ’ป

Ben Halpern
Ben Halpern

Posted on

Have you used the new "suggested changes" in GitHub pull requests?

These are pretty cool! "Suggested Changes" are in public beta and allow you to pitch code alterations which can be one-click merged.

You can apply a suggested change directly in a pull request if you have write access to the repository and are the author of or assigned to the pull request.

Guide

I have not actually made use of this yet. Have you? What is your opinion either way.

Top comments (16)

Collapse
citizen428 profile image
Michael Kohl • Edited on

Tried it the other day, but it didn't seem to work for multi-line suggestions. If you type multiple lines all of them will replace the one line you originally clicked on, which is not super useful for me.

Collapse
citizen428 profile image
Michael Kohl

I'm not attempting to rewrite a whole PR, but sometimes you just want to split a method into two, or completely rewrite it.

Collapse
vinibrsl profile image
Vinicius Brasil

We've used here for simple changes, like changing the i18n strings. It worked very well, but it'd be great to have more changes per commit. It creates a commit for every change.

Collapse
theoutlander profile image
Nick Karnik

What is considered a single change? How do they limit it at the moment?

Collapse
vinibrsl profile image
Vinicius Brasil • Edited on

Not that they're limiting. Like, if you have 5 fixes that you can pack into a single commit, this new suggestion feature will do it, but won't pack into a single commit. Instead, it will create 5 commits. That can be an issue if you have CI, that will cause to trigger it 5 times.

Collapse
aspiers profile image
Adam Spiers

Is it just me or is the way to suggest changes completely non-obvious? In which case I'm really surprised and confused why it is not mentioned here in the post or in the comments, or even linked to. I had to google for several minutes to figure out the syntax to put in a review comment:


```suggestion
        <div class="col-sm-10 col-md-8 col-lg-6 p-2">```

except maybe with a newline before the last triple backticks.

Collapse
bruceszalwinski profile image
Bruce Szalwinski • Edited on

Ran into the same issue. Finally found the suggestion icon to the left of the font / bold / italics.

suggestion

Collapse
aspittel profile image
Ali Spittel

This is super helpful for grading. I normally do code snippets within PR comments, this will make that look even better!

Collapse
ferricoxide profile image
Thomas H Jones II

Tried it, already. It's useful for very small spiffs. Can be useful for reducing some of the time lost to "request changes" โ†’ "add requested changes" โ†’ "re-review" ...but really if there's only like one or two spiffs and each spiff is a couple characters.

Collapse
vintprox profile image
Rodion Borisov

How would you suggest a change for custom file though, within the thread about another file?

Collapse
theredspy15 profile image
Hunter Drum

I haven't used it yet.

While I like the idea of quickly suggesting changes, I prefer pull request as you can run tests using services like Travis Ci before merging

Collapse
fxedel profile image
Felix Edelmann

Suggested changes only work in common with pull requests. Say, user A creates a new PR. User B reviews it, finds a typo and suggests a change to fix the typo. User A can then accept that change, which results in another commit to the PR that includes the suggested change.

You still have the advantage of Travis CI and so on, but the review process is accelerated when there are only small changes requested.

Collapse
ahmadawais profile image
Ahmad Awais โšก๏ธ

WOW! ๐Ÿ˜ฎ

Collapse
thomasbnt profile image
Thomas Bnt

Great ๐Ÿ™ƒ

๐ŸŒš Friends don't let friends browse without dark mode.

Sorry, it's true.