Live data from Hacker News

Git-absorb: Git commit –fixup, but automatic

github.com

251–260 of 278 posts

Re: Git-absorb: Git commit –fixup, but automatic

#251

There seems to be an alternative implementation called git-autofixup: https://github.com/torbiak/git-autofixup Has anyone compared the two?

Yes, I empirically found the hunk-based approach of git autofixup to work more reliably. I use it via magit. Paired with rebase --update-refs, it's particularly helpful to automatically fixup stacked branches.

Re: Git-absorb: Git commit –fixup, but automatic

#252
post #169

Small question to anyone with this workflow. Do you (re)run CI on every affected commit? If no, what is the point of small commits if you lose any guarantees? I much prefer the honest linear non-modified history.

Why do you ask that question as if that is the obviously most important factor?

My history is read much more than it is checked out. And definitely much more than it is stress-tested by some CI. Readability matters more.

I’m having a hard time imagining all the supposed “commit for coffee break” committers who also are die-hard bisect users that go nuts when someone doesn’t run the whole CI on every commit.[1]

And if you don’t have that many commits to check because you “squash merge”: `git bisect start --first-parent` gives you exactly the same result.

Re: Git-absorb: Git commit –fixup, but automatic

#253
post #158

In what situations does this solve a problem? In our projects we only enable squash merge in GitHub and the PRs can have any commits you want. The squashed commit includes link to PR, and PR has detailed summary (which wouldn’t be practical in the commit message).

Admittedly git absorb solves a smaller problem. Because if you do squash merges and leave the history in GitHub you have much bigger problems.

Re: Git-absorb: Git commit –fixup, but automatic

#254
post #236

Earlier quoted context omitted.

> I find conventional commits helpful when deciding what makes an atomic change. I already know if I’m doing a fix, a refactor, a “chore” etc. Conventional commits just happen to be the ugliest way you can express those “types” in what looks like English.

Yeah, well, that's just, like... your opinion, man. But I've worked with many, many developers who don't strictly separate commits by type this way. I myself am tempted to do a fix in the same commit as a refactor many times. Conventional commits simply suggest, well, a convention for how to make this separation cleaner and more explicit, so that the intent can be communicated better within a team. I've found this he…

The prettier way is English.

Re: Git-absorb: Git commit –fixup, but automatic

#255

The negativity in the comments here is unwarranted in my opinion. I've been using `git absorb` for years and it works amazingly well. I use it in addition to manual fixups. My most common uses of git-absorb, but definitely not the only, are when I submit a PR with multiple commits and it fails CI for whatever reason. If fixing CI requires changes across multiple commits (say, lint violations), then git-absorb will al…

I’ve been using autofixup for this and it’s been ok but not great, it can be quite slow as things grown, and it doesn’t say anything when there was no match so it’s easy to miss. How does absorb surface that? > Perhaps partially due to how GitHub works. That’s definitely a major factor, I’d like to use stacked PRs they sound really neat, but GitHub. Also even with stacked PRs I figure sometimes you’re at the top of t…

Same workflow here, and it's become a breeze with autofix, rebase --update-refs, and a small command to push the whole stack. I'm using magit, so I directly see what could not be matched and remains staged.

Re: Git-absorb: Git commit –fixup, but automatic

#256
post #14

I tried using this tool after seeing recommendations for it, but IME it got the parent commit wrong enough times that the work to undo the damage was more than if I had looked up the commit myself and used `--fixup` instead. So I moved back to this manual workflow pretty quickly. I prefer having full control over my commit history, and this tool is too much magic for my taste. I'm sure that it could be improved so th…

Give git-autofixup a try, never had any incorrect fixup targets with it's hunk-based algorithm.

Re: Git-absorb: Git commit –fixup, but automatic

#258

Earlier quoted context omitted.

I use git autofixup; it was much better than git absorb last time I checked > it doesn’t say anything when there was no match that's what it should do > it can be quite slow as things grown How? All the slowness (on large repos) I've seen has been fixed.

> that's what it should do No it is not. > How? I don’t know, that’s just an observation from using it, semi regularly I autofixup changes and it takes a while to do anything.

you're probably using an old version

Re: Git-absorb: Git commit –fixup, but automatic

#259

Earlier quoted context omitted.

It sounds like you have never heard of the Stacked Diffs workflow. Here is an overview: https://newsletter.pragmaticengineer.com/p/stacked-diffs It’s a perfectly reasonable preference to eschew this workflow, but definitely worth understanding the pros and cons.

Every explanation of stacked diffs I've seen (including this one) makes me think there is some secret magic not being shared that will make the whole idea "click". If the problem is devs having to wait too long for PRs to be reviewed, breaking tasks up in to smaller diffs should exacerbate the problem, wouldn't it? If diff 2..n follow diff 1 then a review of 1 blocks everything else you're doing, eh? At least the tra…

In my experience five 100-line diffs get reviewed much faster than one 500-line diff.

Especially when you follow best practices like splitting refactors from functional work; the canonical stacked diff for me is “refactor to make the upcoming change easy; add some tests for the existing functionality I want to protect; small diff to actually make the change”.

1 & 2 don’t generally require caffeine to review. 3 probably requires engaging the brain. If you put everything together you need to be on high alert for the whole review.

Re: Git-absorb: Git commit –fixup, but automatic

#260

Earlier quoted context omitted.

That’s a nice summary. What I don’t like about the Git documentation as I’ve read it is that they go between “patch” and “commit” in some places without stopping and explaining what the difference is. It makes sense to them. It’s obvious. But it isn’t necessarily obvious to most people. A patch is a patch proper plus a commit message encoded in a format that git am understands. That’s fine. And the core developers un…

I think part of the confusion is because 'patch' and 'commit' (really snapshot) are duals of each other, but in practice have important technical differences. When speaking abstractly about 'changes' it often doesn't much matter which term is used, but most interactions are with 'commits' so that tends to be the default term to use. However, sometimes the details matter. For example, a 'patch' (diff + description) te…

It certainly matters when you e.g. find a patch in the wild and have no idea what commit it was originally based on. Metadata fiddling becomes more important in email workflows.
Post reply on HN