Skip to content

Commit 0991742

Browse files
authored
Merge pull request #6530 from MadhavJivrajani/merge-method-squash-docs
guide: Add more docs around tide/merge-method-squash
2 parents 6ff7dbb + d429aeb commit 0991742

File tree

2 files changed

+42
-2
lines changed

2 files changed

+42
-2
lines changed

contributors/guide/contributor-cheatsheet/README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -373,7 +373,7 @@ git rebase -i HEAD~3
373373
git push --force
374374
```
375375

376-
**Note**: you can also ask your reviewer to add the `tide/merge-method-squash` label to your PR (this can be done by a reviewer by issuing the command: `/label tide/merge-method-squash`), this will let the bot take care of squashing _all_ commits that are part of this PR and will not result in removal of the `LGTM` label (if already applied) or re-run of the CI tests.
376+
**Note**: you can also use the bot to help squash commits, please see [squashing commits] for more details.
377377

378378
[contributor course]: https://www.kubernetes.dev/docs/onboarding
379379
[contributor guide]: /contributors/guide/README.md

contributors/guide/pull-requests.md

Lines changed: 41 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -318,7 +318,47 @@ For more information, see [squash commits](./github-workflow.md#squash-commits).
318318
For instance, writing a code munger could be one commit, applying it could be another, and adding a precommit check could be a third.
319319
One could argue they should be separate pull requests, but there's really no way to test/review the munger without seeing it applied, and there needs to be a precommit check to ensure the munged output doesn't immediately get out of date.
320320

321-
**Note**: you can also ask your reviewer to add the `tide/merge-method-squash` label to your PR (this can be done by a reviewer by issuing the command: `/label tide/merge-method-squash`), this will let the bot take care of squashing _all_ commits that are part of this PR and will not result in removal of the `LGTM` label (if already applied) or re-run of the CI tests.
321+
**Note**: you can also use the `tide/merge-method-squash` label on your PR to let the bot handle squashing
322+
_all_ commits, which can be done by commenting `/label tide/merge-method-squash`. As opposed to squashing by hand, this will prevent removal of the `lgtm` label (if already applied) and re-run of the CI tests. Although,
323+
if this label is used, please know the following:
324+
325+
- All commit messages will be squashed and combined and the final commit message will be a combination of all
326+
commit messages according to how GitHub generates the [message for a squash merge](https://docs.github.com/en/pull-requests/collaborating-with-pull-requests/incorporating-changes-from-a-pull-request/about-pull-request-merges#merge-message-for-a-squash-merge), for example, if this is the lifecycle of your PR:
327+
```
328+
# commit 1
329+
Original commit msg
330+
331+
Some useful information
332+
Some more useful information
333+
```
334+
```
335+
# commit 2
336+
Address review comments
337+
```
338+
```
339+
# commit 3
340+
Fix test
341+
```
342+
After applying the label, if the PR is merged, the final commit message will end up being:
343+
```
344+
Title of your PR (#PR-number)
345+
346+
* Original commit msg
347+
348+
Some useful information
349+
Some more useful information
350+
351+
* Address review comments
352+
353+
* Fix test
354+
```
355+
Since commit messages are meant to be a record of the "why" and "what" of your changes, having
356+
messages like "Address review comments" in the final commit message adds no real value in terms
357+
of communicating the "what"s and "why"s of your change. Please see [Commit Message Guidelines](#commit-message-guidelines) for more details on writing better commit messages.
358+
359+
Using this label can help when squashing by hand is considered too challenging or not worth the
360+
extra effort. It can also speed up merging because squashing by hand implies getting another LGTM
361+
from a reviewer and re-run of the CI tests.
322362

323363
## Commit Message Guidelines
324364

0 commit comments

Comments
 (0)