Do you know the best way to suggest changes on a Pull Request?

Last updated by Brady Stroud [SSW] 3 months ago.See history

Normally, the best way to provide feedback on content changes is to use the change X to Y format. When it comes to reviewing Pull Requests (PRs) in GitHub, this is not the case - it's inefficient for the PR owner. They have to manually interpret each suggested change, implement them in the code, and then commit the changes, which can be time-consuming.

Video: Pull Request Suggestions | Brady Stroud | SSW Rules (4 min)

bad pr suggest changes
Figure: Bad example - GitHub - Using change X to Y format (need to copy+paste changes)

Instead, reviewers should use GitHub's Add a suggestion feature. This allows the reviewer to directly suggest changes in the code diff view, and the PR creator can easily accept or reject these changes with a single click. This process is more streamlined and makes it easier to implement suggestions.

good suggest a change button
Figure: Good example - GitHub - Using the 'Add a suggestion' button

When the PR creator reviews the suggestion, they can either click 'Commit suggestion' to apply it directly or 'Resolve conversation' if they choose not to apply it.

good pr suggestions
Figure: Good example - GitHub - Easy to see what has changed + awesome 'Commit Suggestion' button ✨

If an author has made multiple suggestions to your code it may be best to add the suggestions in a batch and then. This allows you to create a single useful commit message that summarizes the changes in the feedback.

batch suggesions
Figure: Good exmample - Applying code suggestions in a batch

We open source.Loving SSW Rules? Star us on GitHub. Star
Stand by... we're migrating this site to TinaCMS