Today's English Expression 21/30 - Step: Receiving and responding to reviews. All example sentences were created for this post. They are not taken from actual repository comments, and the commit messages are examples.
Table of Contents
- At a Glance
- 1. Meaning and Nuance
- 2. Example Sentences
- 3. Similar Expressions and Differences
- 4. Common Mistakes by Korean Speakers
- 5. One-Line Practice
- Model Answer
- References
At a Glance
| Expression | Could you squash your commits? / Squashed into one commit. |
| Meaning | Could you combine your commits? / Squashed into a single commit. |
| Usage Context | Requests and responses in the final stages of a review |
| Politeness | Neutral. It is a procedural request. |
1. Meaning and Nuance
"Squash" means to press or crush something flat, and in Git, it refers to combining multiple commits into one. You do this by selecting squash or fixup in git rebase -i , or by using git commit --fixup and git rebase --autosquash together.
Why ask to combine them? Going through reviews accumulates commits like "fix typo", "address review comments", and "wip". While these are useful during the review, they make the history hard to read after being merged. The KubeVirt reviewer guide states that every commit should be meaningful and instructs reviewers to ask for commits like "Fix reviewer comments", "wip", and "addition" to be squashed.
When to squashis also important. The Kubernetes contribution guide advises uploading fixes as new commits during the review and not squashing them yet. This is because reviewers need to be able to see the modifications separately. Squashing is done when requested, usually around the time you receive LGTM. The guide also sets criteria: combine fix-up commits, but do not combine independent changes that share a single goal. Additionally, in repositories using Prow, you can use the tide/merge-method-squash label to let the bot combine commits upon merging, which explains that unlike manual squashing, this prevents the lgtm label from disappearing or requiring CI to be rerun.
Squashing changes commit hashes, so a force push is required. We use git push --force-with-lease seen in Episode 12.
2. Example Sentences
Scenario 1: Maintainer's Request
This looks good to merge. Could you squash the fixup commits into the main one before we merge?
Scenario 2: Author's Response
Done. Squashed into two commits: one for the API change and one for the generated files.
Keeping generated files in a separate commit is a common convention to make it easier for reviewers to focus on human-written changes. Follow repository rules.
Scenario 3: When the Author Asks First
Should I squash the commits now, or would you prefer to keep them separate until the review is done?
Preferences vary by reviewer, so asking is the safest route.
3. Similar Expressions and Differences
- Squash and merge. This is the name of a merge method on GitHub. If the maintainer merges using this button, the author does not need to combine them manually.
- Could you clean up the commit history? This refers broadly to cleaning up commit messages and reordering, not just squashing.
- Fixup commit. A small commit made to fix a preceding commit, with the premise of being combined later.
4. Common Mistakes by Korean Speakers
- Squashing and force-pushing every time a modification is made during the review. This makes it difficult for reviewers to find what changed.
- Corrected sentence (PR comment): Pushed the fixes as separate commits for easier review. I'll squash them before merge.
- I merged my commits into one. Using "merge" can evoke branch merging, which is confusing.
- Corrected sentence: I squashed my commits into one.
- Squash is done. The subject and verb are awkward.
- Corrected sentence: Done, squashed.
5. One-Line Practice
As the author, write the following as a comment.
I combined the review modification commits into a single commit and force-pushed.
Model Answer
I've squashed the review fixes into a single commit and force-pushed.
Even when used as a verb, "force-push" often includes a hyphen. Letting the reviewer know you force-pushed helps them immediately understand why the screen changed.
Titi's Tip. Accumulate commits during the review and combine them at the end. Following this order is easier for both reviewers and the history.
References
- Kubernetes Contribution Guide, Pull Request Process (Squashing): https://github.com/kubernetes/community/blob/master/contributors/guide/pull-requests.md
- KubeVirt Reviewer Guide: https://github.com/kubevirt/kubevirt/blob/main/docs/reviewer-guide.md
- Git 문서, git-rebase(
--autosquash): https://git-scm.com/docs/git-rebase