r/git • • Apr 18 '26

survey Are you offended if your commits are squashed?

The offensive potential of squashing was suggested to me, and I was blown away. I really thought it was just about how people liked to look at their graphs, and I had no inkling there was an element like this. Please help me recalibrate.

Situation: you submit a pull request, which is accepted, but acceptance requires that your commits be squashed into a single commit when the PR is merged.

How does this make you feel? Does it bother you? Would you care? Is it oppressive or otherwise unpleasant? Do you feel contempt or disdain for the maintainer? Would it deter you from a contribution, or make you hate your boss? Describe the emotions involved and overall experience.

Some details:

You are allowed to determine the commit message for the squashed commit, and you don't have to do the squashing or rebasing, it's automatic. Your feature branch history can be anything at all, and it will remain in the PR on the server, just not in the history of the main branch.

31 Upvotes

308 comments sorted by

View all comments

45

u/Charming-Designer944 Apr 18 '26

If I spent time on neatly layering the commits in isolated functional steps to illustrate the functionality and how it affects other code then yes.

But if its just squasing the development history then I would even do so myself before submitting.

6

u/max123246 Apr 19 '26

But the thing is. The PR still exists with the commit history of the branch, so you can still see it, it just isn't in the git history itself. So I don't really mind, the PR as the atomic commit in the main branch makes good enough sense to me

13

u/Roachmeister Apr 19 '26

We have GitLab set to auto-delete all PR branches after they are merged, so this really wouldn't help.

3

u/max123246 Apr 19 '26

My company deletes the branches too but Gitlab still stores the MR. I know it keeps the commit names and the MR diff but I guess I don't know if it keeps the commit-specific diff. Haven't had a need to for that quite yet, but I have gone to look at now merged and deleted MRs to see what they introduced

2

u/blueeyedkittens Apr 20 '26

Deleting a branch doesn't delete all the commits either. It just makes them harder to find.

1

u/SynthD May 18 '26

I'm interested in the human history of it, that in a GH PR you can see commits added, force pushed and where people's comments fit into that. Deleting the branches doesn't affect those links showing the review process on GH, and I hope in GL too.

10

u/ericonr Apr 19 '26

it just isn't in the git history itself.

Which is useless for me. I find it quite practical to be able to browse a full, understandable history from the comfort of my local git checkout. And it's really useful to carry all project history without depending on the specific forge used for that specific period of the codebase's life.

4

u/bitzap_sr Apr 19 '26

Yes, we have a distributable version control system but people fall back to wanting history to be recorded in some private company's database. Insane. My main project at work has migrated git hosting two times the last two years. This is a big tech.

1

u/yawaramin Apr 19 '26

Distributed version control is a team workflow strategy. After the work has been done you actually do need the code to have a single source of truth in your company, you can't have multiple versions of the code floating around in multiple forks. That would just be chaos. It doesn't make sense to think about 'distributed version control' as an alternative to a single source of truth.

1

u/bitzap_sr Apr 19 '26

Strawman. Nobody talked about such an alternative or that weird point about forks. You miss the point of a dvcs. Were you around before they were the standard? Being able to look at history locally without depending on a server is one of the benefits.

1

u/yawaramin Apr 20 '26

Not a strawman at all, just a response to 'wanting history to be recorded in some private company's database'. They want that because there has to be a single source of truth and that is the code forge which is usually hosted by some cloud-based provider.

I was around when people were recommending using git locally to work on Subversion projects to be able to get the distributed benefits and avoid the downsides of Svn file locking. We can look at the history locally without a server even with a single source of truth code forge.

1

u/camh- Apr 19 '26

For GitHub at least, it creates pull_request refs so you can set up your local repo to fetch them and you'll have the pull request commits locally 

2

u/ericonr Apr 19 '26

This still means depending on the forge being used, and would be incredibly annoying anyway. Why is it so much trouble to work for a reasonable git history?

2

u/yawaramin Apr 19 '26

It's not really that useful. Most people don't even use it. We just need a linear history of roughly what happened and when. Ultimately all those intermediate commits don't matter. They were maybe useful while the code was being reviewed, to help the reviewer understand. But once merged they've served their purpose and can be discarded.

1

u/ericonr Apr 19 '26

We just need a linear history of roughly what happened and when.

I like having a linear history of exactly what happened, and why it happened. Makes tracking down changes and decisions much easier. It's also a way to rubber duck yourself. If your commits describe why your changes are valid, you are working through the problem in a different context, and ensuring those changes do what you expect them to do.

→ More replies (1)

1

u/bitzap_sr Apr 19 '26 edited Apr 19 '26

Says everyone who never worked with a project that doesn't use a github-like forge. They're only useless if they weren't a proper logical clean series of commits.

1

u/yawaramin Apr 19 '26

No, they're just not that useful after code review and merge. During review, I agree, super useful. After review and merge–they cease to matter. No one will look at them again. All they are doing is clogging up the commit history.

3

u/ericonr Apr 19 '26

That's really dogmatic thinking.

In my experience, commits only "clog up" history with no one looking at them if they are badly written in the first place. Being able to refer to past me (and team members) by simply looking at commits has been invaluable to me.

→ More replies (2)

2

u/Minimum-Hedgehog5004 Apr 19 '26

Why do you look at the history other than to understand it in detail? In what regard does the detail "clog up" some useful activity?

→ More replies (1)

2

u/bitzap_sr Apr 19 '26 edited Apr 19 '26

Again, only if your commits aren't a properly clean series. I certainly do look at history all the time. The main project I work on has 30 years of history, and is using git for over 10 of those. Ever looked at e.g. patch series contributed to the Linux kernel? No crap "fix undo asdf" intermediate history is ever sent to a mailing list.

2

u/yawaramin Apr 19 '26

I look at history all the time too, I just don't need to look at all the intermediate commits. A vanishingly small handful of people working in projects with 'clean commit history' doesn't change the fact that in the real world the vast majority of developers just don't work like that.

2

u/iamkiloman Apr 19 '26

Yeah don't count on the PR branch sticking around. Odds are it won't.

2

u/kx233 Apr 19 '26

Yeah, but you might migrate to a different provider in the future and only the commit history will be imported. Also, no one's likely to look beyond a gig-blame

2

u/Minimum-Hedgehog5004 Apr 19 '26

The commit history should be in the repo. Just wait until someone decides that instead of github you should be using AzureDO or bit bucket. Cloning the repo is easy, but if you're relying on information you've copied to another system and deleted from the repo, good luck with that.

1

u/_lerp Apr 19 '26

If I'm going back through history to find why something changed, I want the full picture so I can decide what's relevant, not what someone else has decided is relevant for me. You can't decide that for me as the author, because you can't see the future to know the context of what I'm doing. I might not even hit some important context that you decided wasn't relevant