# Squash when merging?

**URL:** <https://racket.discourse.group/t/squash-when-merging/2105>\
**Category:** Internals\
**Created:** [July 16, 2023, 10:39pm UTC](https://racket.discourse.group/t/squash-when-merging/2105 "2023-07-16T22:39:34Z")\
**Posts on this page:** 1\
**Showing post:** 22

<div class="post-metadata">

**Author:** ![LiberalArtist](https://yyz2.discourse-cdn.com/free1/user_avatar/racket.discourse.group/liberalartist/32/151_2.png) [@LiberalArtist](https://racket.discourse.group/u/LiberalArtist)\
**Post date:** [July 19, 2023, 1:24pm UTC](https://racket.discourse.group/t/squash-when-merging/2105/22 "2023-07-19T13:24:48Z")

</div>

I agree with everything in this thread, I think.

> [@mflatt](#):
>
> There are sometimes larger PRs where keeping the commits makes sense, but that's not the usual case.
> 
> I can see why you'd ask, because PR #4676 is a good example where squashing is better. The commit messages in that case make sense as part of a PR revision process, but not as a part of the Racket source history. I imagine the PR author expected squashing in in this case (maybe because I almost always squash when merging).

A recent example that I am glad was _not_ squashed when merging is [Add `#:indent` to `write-json` [reprise] by LiberalArtist · Pull Request #4686 · racket/racket · GitHub](https://github.com/racket/racket/pull/4686), which consisted of four commits:

1. [[json]: Add `#:indent` to `write-json`. · racket/racket@92ba659 · GitHub](https://github.com/racket/racket/commit/92ba65972547e020ceca8115bbb19a4caa039a9d)
2. [json: add tests for `#:indent` · racket/racket@d10c2fc · GitHub](https://github.com/racket/racket/commit/d10c2fc1e5e7cb3de1d2ff89e9820cc5147ac095)
3. [json: fixup indentation of objects · racket/racket@6f8824d · GitHub](https://github.com/racket/racket/commit/6f8824d4f360ba6d2fda5f5e063a5279661d0aa3)
4. [json: remove `#:indent` test datum 2155a30 · racket/racket@7e9b9c6 · GitHub](https://github.com/racket/racket/commit/7e9b9c6759c1bcb7d205f3e1e83684076afe68c6)

The first commit was written a year before the rest and by a different author. (I did squash the 11 commits from [the earlier PR](https://github.com/racket/racket/pull/4300) when picking it up.)

I'm especially glad the third commit was not squashed because there was a lot of discussion in the earlier PR and at [Json Beautifier - #2 by LiberalArtist](https://racket.discourse.group/t/json-beautifier/1541/2) about exactly what behavior the `#:indent` option should implement. I imagined it could have been horribly confusing to the future bug-hunter not to note in the history the subtle change from the almost-correct behavior.

The last commit was a more marginal case, but the underlying problem confused me enough to err on the side of being explicit.

---

_[View the full topic](https://racket.discourse.group/t/squash-when-merging/2105)._
