News for hackers. Stuff that matters.
Re:Julia Evans: Git rebase, what can go wrong by davedx on Monday November 06, 2023 @12:09PM (#38165320)
I’ve never understood the tradeoff of rebasing, squashing or otherwise “keeping a clean history”. It always seemed like tons of sometimes highly error prone work (sometimes you can wipe out a colleague’s work with it! Wtf!), for almost no gain (why does it matter that the git history is “clean”?).
Re:Julia Evans: Git rebase, what can go wrong by nemetroid on Monday November 06, 2023 @12:22PM (#38165535)
It matters because when I:

* use filtering commands like "git log -S"

* press the "annotate" button in my IDE and can see which commit introduced each line

* run "git bisect"

* use "tig" to drill down through the history of a file (shortcut "," is "move to commit preceding current line's blame commit")

...every step of the way, I get a meaningful description of why a change was made and what other diffs were necessary to achieve that change. And not just "fix", "bug", "PR commments".

Re:Julia Evans: Git rebase, what can go wrong by nomel on Monday November 06, 2023 @02:16PM (#38167375)
> * press the "annotate" button in my IDE and can see which commit introduced each line

In PyCharm, I can see which commit introduced each line, regardless of branching. Is this an IDE limitation you're seeing?

Some with drilling down through a files history.

> every step of the way, I get a meaningful description of why

Isn't this more about commit messages, than anything else?

Re:Julia Evans: Git rebase, what can go wrong by nemetroid on Monday November 06, 2023 @04:07PM (#38169019)
The context of my comment is the usefulness of a clean history, not about merging vs rebasing.

> Is this an IDE limitation you're seeing?

I'm using Jetbrains too.

Re:Julia Evans: Git rebase, what can go wrong by WorldMaker on Monday November 06, 2023 @03:35PM (#38168593)
* `git log --first-parent -S`

* `git blame --first-parent`

* `git bisect --first-parent`

* At least one "tig-like" with a --first-parent first UI: https://github.com/kalkin/git-log-viewer

Re:Julia Evans: Git rebase, what can go wrong by seba_dos1 on Tuesday November 07, 2023 @10:45PM (#38186517)
--first-parent is incredibly useful, but having both merge commits and properly curated atomic commits under them is even more useful.
Re:Julia Evans: Git rebase, what can go wrong by heisenberg302 on Monday November 06, 2023 @12:29PM (#38165656)
Another thing is if you keep commits in a clean "state", it is easier to revert a commit, when you squash or keep them messy it can make it harder to revert.

Also sometimes you decide you want to backport some change to other releases, and if commits are in a good state, it is much easier to do this.

Re:Julia Evans: Git rebase, what can go wrong by pm215 on Monday November 06, 2023 @12:20PM (#38165483)
For me the big gain is at the code review stage. It's much easier to review a set of patches that are a clear and distinct sequence of changes without "oops, fix bug" changes later in the series. It does require extra work by the code author, but it means less work for the code reviewer. Depending on the project and the organisation and the workflow, that can be a worthwhile tradeoff.
Re:Julia Evans: Git rebase, what can go wrong by nicolaslem on Monday November 06, 2023 @12:22PM (#38165521)
Sometimes when working on an old code base built by developers that came and went, one needs to perform what I call "code archeology": going back in time to understand why a feature was implemented the way it was.

Whether this is feasible at all depends largely on the care developers put in structuring their commits.

Re:Julia Evans: Git rebase, what can go wrong by ohwellhere on Monday November 06, 2023 @12:24PM (#38165559)
Yes! The source code is itself the first level of documentation. The commit history is the second.

A free form textual interface to document everything about why you made the changes you just made? Why not maximize the value of this resource!

Re:Julia Evans: Git rebase, what can go wrong by Izkata on Monday November 06, 2023 @03:16PM (#38168326)
This has become a large chunk of my job over the past few years, as part of fixing/upgrading systems no one has touched in a decade, and none of those original people are still here. There are some weird things in there I've only been able to figure out because all the svn history still exists.
Re:Julia Evans: Git rebase, what can go wrong by ajkjk on Monday November 06, 2023 @12:14PM (#38165389)
Never understood why you wouldn't want it clean. There's no benefit whatsoever to it being messy and it's a liability for a lot of reasons, whereas the clean version is free and easy and makes everything you do that interacts with git history simpler.
Re:Julia Evans: Git rebase, what can go wrong by btilly on Monday November 06, 2023 @12:33PM (#38165718)
There is a giant benefit to it being messy. And that is that the mess is the actual history.

Every time you do a git rebase, you are literally asking your source control system to lie about history. If you mess up, and you eventually will, you're then forced to manually figure out what the history really was despite being lied to. If you mess it up, well, good luck.

I used to work at a company where someone (we never figured out who) in another group would rebase every few weeks. We didn't find out about it until their stuff was pushed then released. The result was that features which we'd written, QAed, and released to production would simply disappear a few weeks later. With no history suggesting that it ever existed.

Have you ever been pulled off of a project to go fix a project from a month ago which has disappeared from source control? You don't know what happened, you no longer have context, you've just got complaints because your stuff no longer works.

Is your desire for a "clean history" worth potentially creating THAT disaster for other developers on your team???

Re:Julia Evans: Git rebase, what can go wrong by diek on Monday November 06, 2023 @12:47PM (#38165908)
The golden rule is "do not rewrite history of a public branch". Rebase/squash your PR branches to your heart's content, but once it's merged that's it.

You get clean history by not merging branches with 50 intermediary "fiddling with X" commits in them.

Re:Julia Evans: Git rebase, what can go wrong by btilly on Monday November 06, 2023 @12:52PM (#38165988)
Related, it is a bad idea to use long-running per team branches. Merge early, merge often, get commits to trunk ASAP. With best practices on unit testing, code review, and so on, this scales to many thousands of developers. And will save a lot of pain over time.
Re:Julia Evans: Git rebase, what can go wrong by debaserab2 on Monday November 06, 2023 @12:57PM (#38166079)
> I used to work at a company where someone (we never figured out who)

Wouldn't this be trivially solvable by git bisecting your deploy branch?

Re:Julia Evans: Git rebase, what can go wrong by btilly on Monday November 06, 2023 @01:14PM (#38166356)
No, because git bisect operates off of the information in the history. And thanks to the bad rebase, the history no longer existed in the branch.
Re:Julia Evans: Git rebase, what can go wrong by lifeisstillgood on Monday November 06, 2023 @01:31PM (#38166654)
Just clarifying ... they took a version of master from say a month ago, did their work on it, then, they force pushed their work out, wiping everyone else's work that was added to master since one month ago?

I mean that's the equivalent of reversing your JCB through a house on a building site because "the house was not there a week ago when I last moved the JCB".

or am I missing something?

Re:Julia Evans: Git rebase, what can go wrong by btilly on Monday November 06, 2023 @01:40PM (#38166794)
Basically equivalent to that. This was about a decade ago.

We had 4 teams, each released on a schedule. Each team had a branch. When a team released, it was merged from master, then each team pulled. The person who did the pull would change, and it was often a rebase.

So my team released, some other team rebased badly. There would be no sign of problems for us until after they released. But since 2 teams generally released at once, and people didn't remember who actually did the merge a few weeks earlier, it was hard to figure out who was actually messing up. (I had suspicions, but no proof.)

I've seen rebase used appropriately since. But that disaster left scar tissue.

Re:Julia Evans: Git rebase, what can go wrong by lifeisstillgood on Monday November 06, 2023 @01:47PM (#38166910)
So (sorry for picking on this scab) there became 4 branches each of which for the team concerned was the next beautiful branch and then say each week a team woukd merge into master and everyone woukd rebase but fuck that up once and now the beautiful branch team B is working on is out of step with the real master ... oh god.

Yeah that would leave a mark.

Re:Julia Evans: Git rebase, what can go wrong by Chris_Newton on Monday November 06, 2023 @06:39PM (#38170900)
It looks like you’re talking about rewriting history that has already been shared. Pretty much everyone agrees that is a bad idea. It even has a prominent warning in the git book.

What others here, including myself, are advocating is rewriting your own history before you share it, which makes a very different set of trade-offs.

Re:Julia Evans: Git rebase, what can go wrong by latexr on Monday November 06, 2023 @03:09PM (#38168210)
Wasn’t `git reflog` viable?
Re:Julia Evans: Git rebase, what can go wrong by btilly on Monday November 06, 2023 @03:53PM (#38168851)
How do you find the right commit from a month ago to reflog to?

How do you determine which combination of changes are yours, and not accidentally undo changes that other developers made in the last month?

Could git reflog have helped? Maybe sometimes. If we had the foresight to have saved the right commits from the past, sure. I think we did start saving old branches just in case it happened again, but then we had to sort through a month of changes to figure out what to keep, what to change, and what conflicts there might be.

Remember, the person screwing up didn't know he screwed up. And the person trying to fix it is doing so a long time after the fact. It was a disaster.

Re:Julia Evans: Git rebase, what can go wrong by yxhuvud on Monday November 06, 2023 @05:59PM (#38170392)
But that make no sense, as the second someone pulls from that branch it would be noticed.
Re:Julia Evans: Git rebase, what can go wrong by foobarbaz33 on Monday November 06, 2023 @01:14PM (#38166366)
> the mess is the actual history.

The true history is not recorded in your normal commits either. Every time you modify your source buffer, that is the true sequence of events. This truth is lost already as you undo/rework things before you commit. You're ALWAYS manipulating and telling a false story of history whether you realize it or not.

Commits are a tool that give stronger backup/undo protections over simple file saves and in-memory editor undo lists. Just because you happened to save your work in a commit doesn't mean it should be instantly be regarded as holy history. Not anymore so than if you simply saved the file.

I think the bar for "holy" history should be whether it is published to a shared branch.

Re:Julia Evans: Git rebase, what can go wrong by btilly on Monday November 06, 2023 @01:22PM (#38166491)
I believe that you are confusing "full history" and "true history".

Every single point in the commit history represents an actual state of a repository at a specific point of time, along with the information of which point or points were next before it. This is all part of the true history.

This is not a full history - you don't have every keystroke, abandoned commit, switch between branches and so on. But nothing that you're being told is wrong.

As soon as you do a rebase, you're rewriting history. You're claiming that there were specific points of time with specific states that never actually existed. You're losing information about points of time and specific states that actually existed, which someone once considered important enough to do a git commit over.

The difference becomes important if that someone, which at a previous job was me far more often than I would like, tries to go back to the historical commit. And finds that it is gone without a trace.

Re:Julia Evans: Git rebase, what can go wrong by foobarbaz33 on Monday November 06, 2023 @02:31PM (#38167610)
> As soon as you do a rebase, you're rewriting history.

Agreed. But the rewrite occurs in your private branch. It's history is just as private as the undo list in your editor. No one cares about what's going on in your editors undo list. And by the same logic they shouldn't care about commits in a private branch.

> You're losing information about points of time and specific states that actually existed

If you avoid rebase, then you end up "rebasing" without rebasing. You "squash" intermediate states by never recording them to begin with.

Failing to record history is not superior to squashing it.

> And finds that it is gone without a trace.

I don't have the details, but it sounds like someone rebased a public branch. Yes that is bad. But it's sort of like saying we shouldn't drive cars because someone chose to drive the wrong direction down a 1 way road.

Re:Julia Evans: Git rebase, what can go wrong by Nullabillity on Monday November 06, 2023 @04:55PM (#38169587)
> Agreed. But the rewrite occurs in your private branch. It's history is just as private as the undo list in your editor. No one cares about what's going on in your editors undo list. And by the same logic they shouldn't care about commits in a private branch.

The rebase becomes part of the public branch eventually, inflicting your lies on everyone else.

> If you avoid rebase, then you end up "rebasing" without rebasing. You "squash" intermediate states by never recording them to begin with.

If only Git had a third alternative, a way to... entangle two diverging branches of history without destroying or rewriting either. You could say it would be a bit like a car merging into a highway.

> Failing to record history is not superior to squashing it.

"We don't know" is at least an honest statement. Claiming that you do but then making up some nonsense is something that the LLMs do enough of already.

Re:Julia Evans: Git rebase, what can go wrong by foobarbaz33 on Monday November 06, 2023 @07:23PM (#38171332)
I think the crux of the argument is what you think about private git commits. You may think of them as "holy" history. Assuming the commits are still private, I give them no more prestige than the editor's undo log.

What do you think of the editors undo log? It's a very real historical log. Should it be treated as "holy" history too? If not, what makes the undo log less true/important than a private git commit log?

Re:Julia Evans: Git rebase, what can go wrong by Nullabillity on Monday November 06, 2023 @11:33PM (#38173287)
If you did X then Y then Z, there's a difference between saying "I did Y, Z, and X" (squashing/summarizing) and "I did Y then Z then X" (rebasing).

Squashing is often dumb and unhelpful, because you're now re-summarizing the points in time that you already considered worth highlighting when they happened (when you had the most context to judge them!).

Rebasing is lying about the order and/or context that those changes happened in.

Your undo log is comparable to squashing, but not at all to rebasing.

And then again, the first-order vs second-order summarizing distinction matters, and you already capture the second-order summary in your merge commit. Squashing is just destroying information for zero practical benefit.

> private

You keep using that word, but branches are often a lot less private than you think. Push it to get a colleagues' input on something? Congratulations, it's now public. Created a pull request that you want to revise? Already public.

Re:Julia Evans: Git rebase, what can go wrong by tomjakubowski on Tuesday November 07, 2023 @06:43AM (#38175734)
Do you consider it lying when a commit doesn't include all changes in the working tree at the time it was committed? How about when a committer adds a file to .gitignore?
Re:Julia Evans: Git rebase, what can go wrong by dahart on Tuesday November 07, 2023 @10:28AM (#38177894)
My advice is don’t engage with the ‘rebase is a lie’ argument. It is a textbook bad-faith argument, since it deliberately and explicitly ignores the stated intention behind rebase. It’s a talking point that people like to parrot without fully understanding what the author of the argument (Fossil developers) meant, and without fully understanding the implications of the argument. FWIW, HN mods in the past have previously confirmed that repeating this hyperbolic claim goes against HN guidelines.

Fun note though, I argued this directly with Dr Hipp (principal author of SQLite and of Fossil, inventor of the ‘git rebase is a lie’ argument) and during that discussion, he agreed to soften the language on the Fossil pages. They are still hyperbolic, using the word ‘dishonest’, and continue to distort the reasons and usage behind rebase, but he did remove some instances of the word ‘lie’ and ‘lying’, which is progress.

It’s a bit of a shame that they haven’t found the strength to frame Fossil in a positive light without trash-talking the competition. There is a good-faith argument for Fossil vs git, but they’re choosing not to use it.

Re:Julia Evans: Git rebase, what can go wrong by dahart on Monday November 06, 2023 @06:27PM (#38170738)
Git was never intended to capture and preserve the order of git commit commands, and you’re making incorrect assumptions that it was a goal. Maybe the git devs knew there is no useful information and no benefit to being so strict about something so arbitrary, or maybe because forcing people to keep their commits in stone in whatever the first arbitrary way they were added is a big disincentive to making commits at random points in time, which somewhat undermines the point of having a version control system at all.

BTW rebase produces a new commit ordering, but does not modify the old one.

> You’re claiming that there were specific points of time with specific states that never actually existed.

No. You are asserting intent on the part of git users and git that has never existed, you have misunderstood what git history is. The git history is not a claim that the state at that point existed during development, you are projecting your own goals that are not shared by git or git users.

> You're losing information about points of time and specific states that actually existed, which someone once considered important enough to do a git commit over.

Hehe this is so full of assumption. You write it like I’m rebasing someone else’s work, but you already know I’m only rebasing my own commits, and I’m the one who decides what’s important enough to do a commit over.

I like commit early, commit often. I want to make small incremental commits that don’t display to others that way and I expect to put small commits and fix ups together later into a single useful commit with only one commit message.

Re:Julia Evans: Git rebase, what can go wrong by tomjakubowski on Tuesday November 07, 2023 @06:42AM (#38175721)
> Every single point in the commit history represents an actual state of a repository at a specific point of time, along with the information of which point or points were next before it. This is all part of the true history.

Committers always have a choice of which of the changes present in their working tree they stage and then commit. The commit history is always a flat approximation of the real evolution of the files in the repo.

Re:Julia Evans: Git rebase, what can go wrong by Arch-TK on Monday November 06, 2023 @01:21PM (#38166485)
If you think the mess (i.e. 50 mixed up mini commits as you work on a feature and iterate on it) is useful history (it usually isn't) then use a different DVCS because git was not designed around this mode of operation and a lot of its advanced features work poorly when applied to such a history.

Alternative DVCSes which support this workflow include: fossil

Re:Julia Evans: Git rebase, what can go wrong by ajkjk on Monday November 06, 2023 @02:00PM (#38167109)
IMO the relevant 'true history' is at the plane of 'things relevant to other developers'. As far as anyone is concerned, my local work history is that I atomically wrote all my code in a single instant. Commits are that unit of atomicity.

But I have never seen a commit disappear while rebasing, ever. That workflow is busted somehow. They were doing it wrong.

Re:Julia Evans: Git rebase, what can go wrong by dkbrk on Monday November 06, 2023 @04:28PM (#38169273)
> the mess is the actual history.

This argument reminds me of a scene from Yes Prime Minister [0]:

> Humphrey: The minutes do not record everything that was said at a meeting do they?

> Bernard: Well of course not.

> Humphrey: And people change their minds during a meeting don't they?

> Bernard: Well, yes.

> Humphrey: The actual meeting is a mass of ingredients for you to choose from.

> Bernard: Oh, like cooking?

> Humphrey: No, not like cooking. Better not to use that word in connection with books or minutes. You choose, from a jumble of ill-digested ideas, a version which represents the Prime Minister's views, as he would, on reflection, have liked them to emerge.

> Bernard: But if it's not a true record...

> Humphrey: The purpose of minutes is not to record events it is to protect people. You do not take notes if the Prime Minister say something he did not mean to say, particularly if it contradicts something he has said publicly. You try to improve on what has been said, to put it in a better order. You are tactful.

> Bernard: But how do I justify that?

> Humphrey: You are his servant

> Bernard: Oh, yes.

> Humphrey: A minute is a note for the records and a statement of action if any that was agreed upon.

I think the analogy is pretty clear. A pull request does not record every single little change you made when writing it. You choose, from a jumble of ill-digested ideas, a version which better reflects your intent as you would, on reflection, have liked it to emerge. It doesn't matter that it's not a true record, since its purpose is not to record events but to communicate ideas. You try to improve on the commits as they have been written, to put it in a better order. You are tactful.

[0]: https://youtu.be/MF-Qnv2Srfs?si=U6xKNLrTAIn5h1Iz&t=118

Re:Julia Evans: Git rebase, what can go wrong by Nullabillity on Monday November 06, 2023 @04:47PM (#38169491)
You do realize that Yes, Minister is satire...?
Re:Julia Evans: Git rebase, what can go wrong by sethammons on Monday November 06, 2023 @06:45PM (#38170968)
this exact problem led us to block all --force pushes.
Re:Julia Evans: Git rebase, what can go wrong by ajkjk on Tuesday November 07, 2023 @01:28PM (#38180777)
Yeah, that's a standard feature in large organizations afaik.
Re:Julia Evans: Git rebase, what can go wrong by rbehrends on Monday November 06, 2023 @12:23PM (#38165541)
You can have it clean without rebasing. This is simply a matter of properly visualizing the history. Unfortunately, most of the major version control systems have decided to basically just dump a raw graph rather than presenting the history in a more user-friendly fashion.
Re:Julia Evans: Git rebase, what can go wrong by haakonhr on Monday November 06, 2023 @12:17PM (#38165441)
Is it free though?

I'm a fan of rebase myself, but understand the point made above. For me, the biggest pro of a clean history is when doing `git blame`. If the history is clean and the commits are good, it might solve my issue. On the other hand, if the commit in question is a huge mess of unrelated things it doesn't help me at all. I also find it way easier to review a PR with a clean, well-described history.

Re:Julia Evans: Git rebase, what can go wrong by ajkjk on Monday November 06, 2023 @02:03PM (#38167157)
Well I also object to multiple unrelated changes in the same commit. Those should be separate commits, and separate code reviews for that matter.
Re:Julia Evans: Git rebase, what can go wrong by unicornmama on Monday November 06, 2023 @12:37PM (#38165772)
You can run ‘git log —-first-parent’ that will give you the same output as squash merging, without losing the ability to effectively manage stacked branches/PRs.

But because GitHub and other tool’s version of rendering history just flatten merge commits into spaghetti we’re stuck with squash merge. Thanks GitHub.

Re:Julia Evans: Git rebase, what can go wrong by LAC-Tech on Monday November 06, 2023 @03:36PM (#38168607)
I want it clean. But I don't want to do the work to make it clean. The juice is not worth the squeeze.
Re:Julia Evans: Git rebase, what can go wrong by BeetleB on Monday November 06, 2023 @03:56PM (#38168881)
As your parent already said, (and it matches my experience), we didn't have any of these problems when using systems without history rewriting (mercurial, for example).

I recall when I first switched to git at work and the team was insisting on a "linear history", I was bemused: Could these developers really not handle a merge graph? It was bizarre how something straightforward in other VCS is suddenly "messy" amongst git folks.

Re:Julia Evans: Git rebase, what can go wrong by ajkjk on Monday November 06, 2023 @03:58PM (#38168912)
It's not that we/they 'can't' handle it. It's that we choose not to because it's a better life.

It is like moving to one's favorite part of town.

Re:Julia Evans: Git rebase, what can go wrong by BeetleB on Monday November 06, 2023 @04:01PM (#38168942)
> It's not that we/they 'can't' handle it. It's that we choose not to because it's a better life.

As someone who has had to put up with rebase for several years now, my life is definitely not better. And things that were trivial in mercurial are now complicated (seeing the actual chronology - both in the log and in the graph). That graph with multiple branches that git developers find messy can actually be really useful.

Re:Julia Evans: Git rebase, what can go wrong by scintill76 on Monday November 06, 2023 @12:22PM (#38165523)
> sometimes you can wipe out a colleague’s work with it! Wtf!

I’m not necessarily on Team Rebase, but isn't this just as likely with merging gone wrong?

Re:Julia Evans: Git rebase, what can go wrong by adhesive_wombat on Monday November 06, 2023 @12:39PM (#38165793)
It definitely is. I have regularly seen work reverted mistakenly during a merge. There's little fundamental difference between resolving a conflict at rebase or merge, other than one resolves the conflict you would have had with your commit when you made it, and one resolves it with the final commit in the chain. You still have to consider that the right answer is often some mix of each side of the conflict.
Re:Julia Evans: Git rebase, what can go wrong by btilly on Monday November 06, 2023 @12:36PM (#38165757)
Not nearly as badly.

A badly done merge can indeed ruin code. But you'll always have the versions that went into the merge, and the merge itself. Your history has all of the information to recreate exactly what happened, find what changed, and then figure out how to fix it.

A badly done rebase not only ruins your work, it also removes from the branch any record of your work having been done. Unless you can find the right stray old commit which is not yet cleaned up, there is no choice but to start doing it again from scratch.

Re:Julia Evans: Git rebase, what can go wrong by bilalq on Monday November 06, 2023 @12:23PM (#38165544)
When an engineer made a change is of no consequence to me. When it got merged into the main branch does matter a whole lot if you're doing trunk-based development.
Re:Julia Evans: Git rebase, what can go wrong by paulddraper on Monday November 06, 2023 @12:21PM (#38165493)
> keeping a clean history

This being a principal reason for VCS, I very much understand the motivation.

Re:Julia Evans: Git rebase, what can go wrong by naasking on Monday November 06, 2023 @12:51PM (#38165976)
"Clean history" is not a principal reason for VCS. "Full history so you don't accidentally lose something and can revert to any point" is the principal reason. When "clean history" conflicts with "full history", the choice should always defer to the latter. Rebase clearly breaks the full history principle.
Re:Julia Evans: Git rebase, what can go wrong by paulddraper on Monday November 06, 2023 @02:34PM (#38167665)
Part of not losing stuff and reverting is being able to find stuff and precisely revert.
Re:Julia Evans: Git rebase, what can go wrong by rhinoceraptor on Monday November 06, 2023 @05:08PM (#38169762)
There is obviously a point where you do not want full history. For example, it would absurd to use your editor's undo history tree with keystroke level granularity as your VCS, because in most of those points in history, the code won't even compile because you were in the middle of typing a word.

If your goal is to be able to revert the codebase to a previous version, then you want your history to a series of well prepared, atomic changes where at each point the software is actually functional.

Re:Julia Evans: Git rebase, what can go wrong by naasking on Monday November 06, 2023 @06:26PM (#38170735)
Clearly that's the reason you make a commit to begin with. Erasing that commit history is just silly.
Re:Julia Evans: Git rebase, what can go wrong by seba_dos1 on Tuesday November 07, 2023 @10:40PM (#38186476)
There are a lot of reasons to make a commit other than wanting to make an atomic change meant to be integrated onto shared repository. Ignoring those is just silly.
Re:Julia Evans: Git rebase, what can go wrong by naasking on Friday November 10, 2023 @07:38AM (#38218118)
I never said otherwise. I agree 100%, but this seems like an orthogonal point to what we're discussing here.
Re:Julia Evans: Git rebase, what can go wrong by rhinoceraptor on Wednesday November 08, 2023 @08:21PM (#38199697)
I make a commit whenever I want to save my progress, and rarely is it ever in a state that could even be called a "version" of the software that one would want to revert to, until my feature branch is complete and ready for code review.

At that point I have a much better idea of the scope of my changes, and I can revise them into a few coherent commits, rather than a mess of "WIP" commits that are not a useful history to keep.

Re:Julia Evans: Git rebase, what can go wrong by naasking on Friday November 10, 2023 @07:36AM (#38218104)
> and I can revise them into a few coherent commits,

Why bother with this step at all? It's literally pointless and serves only to stroke a silly aesthetic preference.

> rather than a mess of "WIP" commits that are not a useful history to keep.

I also disagree that WIP commits are not useful history. You might have explored 2 or 3 different abstractions to solve a problem, and picked one but it turned out to be the wrong one, and one of the others would have been a better choice, but now you've lost the history where you explored these options. Are you suggesting it's no loss to erase those other commits and the context around which you thought it wasn't a good choice?

Re:Julia Evans: Git rebase, what can go wrong by seba_dos1 on Monday November 06, 2023 @07:53PM (#38171601)
The principal reason for VCS has nothing to do with "history" at all. It has all to do with "versions".

What exactly the word "version" means depends on context. If you put your essay under git, you probably want to track how it was changing with time. When you hack on some codebase and throw things at wall to see what sticks, you want to be able to go back to the previous attempt should your next one turn out to be useless. You may even want to commit things just because it's a convenient way to send things to be built by CI - so you basically produce "versions" to test.

But when you collaborate with others to develop a project, nobody cares about whether you made typos during your hacking session and had to come back to fix them. It's not a useful information and it never becomes a "version" of a shared project, because why would it? It's just confusing and wastes people's time on review, and makes things like blame and bisect harder to use.

Or when you put a tutorial under a git repo, with each commit representing the next step to achieve a certain outcome. You may have tweaked each step gazillion of times to perfect it, but that "history" is completely irrelevant for the resulting repo. It's meant to store "versions", not "history". Those may correlate, but don't have to.

A git repo is a data structure that you operate on. Treat it as such and use to achieve your goals.

What's funny is that "squash on merge" strategy gets you worst of both worlds. You don't get nicely curated versions in your project because if someone actually cared to fine-tune their MR you just throw that information away, and the rest doesn't care in the first place anyway. Rebasing and squashing is an incredibly useful tool for everyday use by developers in their work, but it often gets used as a band-aid for lazy developers instead.

Re:Julia Evans: Git rebase, what can go wrong by naasking on Tuesday November 07, 2023 @08:29AM (#38176479)
> What exactly the word "version" means depends on context. If you put your essay under git, you probably want to track how it was changing with time.

In other words, the history.

> It's not a useful information and it never becomes a "version" of a shared project, because why would it?

Because the real world doesn't match your ideal of how software development works. You need the full history because sometimes innocuous looking "simple fixes" are neither innocuous nor fixes, and because obscuring the history makes auditing and merges more difficult, not less.

> It's just confusing and wastes people's time on review, and makes things like blame and bisect harder to use.

So blame and bisect are poorly written therefore you should hack around them using a convoluted process that obscures the true history and raises the risk of requiring people to redo weeks worth of work by overwriting branch histories on shared repos. Great idea.

The authors of Fossil and Sqlite did a complete breakdown of everything wrong with rebase and what a proper tool should do, so I won't belabour the point further:

https://fossil-scm.org/home/doc/trunk/www/rebaseharm.md

Re:Julia Evans: Git rebase, what can go wrong by seba_dos1 on Tuesday November 07, 2023 @10:33PM (#38186427)
> In other words, the history.

Yes, that was my point. Have you read it?

> You need the full history because sometimes innocuous looking "simple fixes" are neither innocuous nor fixes, and because obscuring the history makes auditing and merges more difficult, not less.

Obscuring logically split and curated commits makes auditing and merges more difficult. Obscuring pointless edit history of the developer makes them easier.

> So blame and bisect are poorly written therefore you should hack around them using a convoluted process that obscures the true history and raises the risk of requiring people to redo weeks worth of work

blame and bisect are powerful tools that can work sensibly in various repository topologies. However, if you're either intentionally putting garbage into your topology, or not utilizing it because of ill-defined idea of "clean history", you're simply doing yourself a disservice.

> by overwriting branch histories on shared repos. Great idea.

Who said anything about overwriting branch histories on shared repos? It has its uses too (it can be useful in some cases when you're a downstream working on a project maintained upstream, for example), but it's not what most projects will ever want to do. That's not what rebase is there for.

Re:Julia Evans: Git rebase, what can go wrong by renewiltord on Monday November 06, 2023 @12:16PM (#38165424)
It's for humans. You can more easily cycle to a specific point. I find linear history easier to comprehend. But it's not like a game ender. People will do whatever they will.

I find it easier to run git binary search with it like this too.

Re:Julia Evans: Git rebase, what can go wrong by tuckerpo on Monday November 06, 2023 @12:46PM (#38165898)
> why does it matter that the git history is “clean”?

Makes reviewing a set of changes prior to a merge much easier. It's nice if there's a 1:1 correlation between a commit message and the actual patch contents.

Im sure you've dealt with the case of reviewing a colleague's changes with a commit message like "Enable logging in foobar module" and the patch is actually enabling foobar logging and a bunch of other stuff.

This makes bisecting your git history to identify and fix bugs much more difficult.

If the git history is clean, you can just read the commit messages and implicitly trust the developer if clean git hygiene is in place (as opposed to actually needing to read the whole diff on a per-commit basis to find out what _actually_ happen at commit XYZ, despite it's message).

Re:Julia Evans: Git rebase, what can go wrong by bregma on Monday November 06, 2023 @01:39PM (#38166790)
It makes your git graph instagrammable.