Iterating on code review feedback
- Using "Amend" button to update a commit
- Using "Update PR" button to update a pull request
Always use "Amend" button to update the commit, instead of making additional commit when addressing feedback from code review.
You can amend any selected changes into current commit.
- git add (selected changes)
- git amend
- git rebase all the children commit to the newly amended commit
Many teams have discovered the value of keeping the main branch concise without the intermediate "junk" commits. Teams might prefer the "Squash and merge" option when merging the pull request.
If that is the case, maintaining the simple 1 commit per pull request modal, and using amend to update that 1 commit will have no differences in the result. But the workflow suddenly becomes much simpler, and merge conflicts are easier to resolve.
The downside is that GitHub support for comparing each force-push is not very good. But this is somewhat bearable because people tend to create smaller, easier-to-review pull requests using Superlog.
Alternatively, there are startups like https://graphite.dev/ and https://www.crocodile.dev/ that are improving the code review process and have better support over stacked pull request and force pushes.
Update Pull Request
You pull request can become stale after you rebase or amend the commit. Either way, you can use "Update PR" button to update it.
- git push --force <current branch>
- git push --force <parent branch>