Skip to content

Commit d429aeb

Browse files
guide: Add more docs around tide/merge-method-squash
This commit adds more information about the label `tide/merge-method-squash` and shows what the commit message ends up looking like if the label is used on multiple commits, especially if the PR contains fixup commits like "address reviews". Adding this documentation to better illustrate the effects of using this label as opposed to squashing by hand and preserve good commit message practices. Signed-off-by: Madhav Jivrajani <[email protected]>
1 parent f5a8a15 commit d429aeb

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
@@ -374,7 +374,7 @@ git rebase -i HEAD~3
374374
git push --force
375375
```
376376

377-
**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.
377+
**Note**: you can also use the bot to help squash commits, please see [squashing commits] for more details.
378378

379379
[contributor guide]: /contributors/guide/README.md
380380
[developer guide]: /contributors/devel/README.md

contributors/guide/pull-requests.md

Lines changed: 41 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -292,7 +292,47 @@ For more information, see [squash commits](./github-workflow.md#squash-commits).
292292
For instance, writing a code munger could be one commit, applying it could be another, and adding a precommit check could be a third.
293293
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.
294294

295-
**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.
295+
**Note**: you can also use the `tide/merge-method-squash` label on your PR to let the bot handle squashing
296+
_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,
297+
if this label is used, please know the following:
298+
299+
- All commit messages will be squashed and combined and the final commit message will be a combination of all
300+
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:
301+
```
302+
# commit 1
303+
Original commit msg
304+
305+
Some useful information
306+
Some more useful information
307+
```
308+
```
309+
# commit 2
310+
Address review comments
311+
```
312+
```
313+
# commit 3
314+
Fix test
315+
```
316+
After applying the label, if the PR is merged, the final commit message will end up being:
317+
```
318+
Title of your PR (#PR-number)
319+
320+
* Original commit msg
321+
322+
Some useful information
323+
Some more useful information
324+
325+
* Address review comments
326+
327+
* Fix test
328+
```
329+
Since commit messages are meant to be a record of the "why" and "what" of your changes, having
330+
messages like "Address review comments" in the final commit message adds no real value in terms
331+
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.
332+
333+
Using this label can help when squashing by hand is considered too challenging or not worth the
334+
extra effort. It can also speed up merging because squashing by hand implies getting another LGTM
335+
from a reviewer and re-run of the CI tests.
296336

297337
## Commit Message Guidelines
298338

0 commit comments

Comments
 (0)