News for hackers. Stuff that matters.
Re:Pre-commit hooks are fundamentally broken by Mic92 on Saturday December 27, 2025 @03:12AM (#46400126)
I can second that. If there are multiple commits: https://github.com/tummychow/git-absorb is handy to add formatting changes into the right commit after commits already happened.
Re:Pre-commit hooks are fundamentally broken by oxryly1 on Saturday December 27, 2025 @11:56AM (#46403115)
It looks like git absorb rewrites history. Doesn’t that break your previously pushed branch?
Re:Pre-commit hooks are fundamentally broken by andrewaylett on Saturday December 27, 2025 @02:13PM (#46404287)
That's a controversy I'm not sure you necessarily realise you've stepped into :).

It's fairly common to consider working and PR branches to be "unpublished" from a mutability point of view: if I base my work on someone else's PR, I'm going to have to rebase when they rebase. Merging to `main` publishes the commit, at which point it's immutable.

Working with JJ, its default behaviour is to consider parents of a branch that's not owned by you to be immutable.

Re:Pre-commit hooks are fundamentally broken by tharkun__ on Saturday December 27, 2025 @03:43PM (#46405070)
My branch is mine. Don't tell me what I can or can't do. I push WIP stuff all the time, to share code with others for discussion, to get the build to run in parallel while I keep working or just at the end of the day. I freely amend and will squashed before merging (we only allow a single commit per branch to go to master).

If I or someone else bases something off anything but master that's on them to rebased and keep up to date.

Re:Pre-commit hooks are fundamentally broken by jghn on Saturday December 27, 2025 @06:14PM (#46406465)
My philosophy is that once a PR is open, that's the point at which people should no longer feel free to treat their branch as their own. Even in groups that squash commits, it should still preserve the aggregate commit messages.

But until that PR is open? Totally with you. There is no obligation to "preserve history" up until that point.

Re:Pre-commit hooks are fundamentally broken by johnisgood on Saturday December 27, 2025 @06:28PM (#46406591)
Not to disagree, but this is so GitHub-centric. What is up with "diffs", "patches", and "submissions"? :D
Re:Pre-commit hooks are fundamentally broken by jghn on Saturday December 27, 2025 @06:32PM (#46406623)
Not to disagree, but calling it Github-centric is a bit over specific :)

I regularly work with Github, Bitbucket, and Gitlab. Everything I said applies except for the fact that I said "PR" instead of "MR". But yes, you're right. I'm highlighting a specific, albeit extremely popular, workflow.

Re:Pre-commit hooks are fundamentally broken by johnisgood on Saturday December 27, 2025 @06:57PM (#46406829)
I know, I know, I was going to edit it to "Git{Hub,Lab}" in the beginning but oh well.

In any case, my comment just reflects on the fact that you had a series of patches that you could not squash or rebase. It stuck.

And the fact that I see many people use the abbreviation "PR" for something that is merely a patch or diff. For example you might send a diff to the tech@ mailing list, but you should not refer to it as a PR.

Re:Pre-commit hooks are fundamentally broken by QuercusMax on Saturday December 27, 2025 @08:00PM (#46407288)
Git{Hu,La}b
Re:Pre-commit hooks are fundamentally broken by patmorgan23 on Sunday December 28, 2025 @08:45PM (#46416506)
GitPub
Re:Pre-commit hooks are fundamentally broken by andrewaylett on Monday December 29, 2025 @03:02PM (#46424869)
Strong disagree: until the branch is merged, it's mine.

I'm in a camp that prefers single rebased commits as units of change, "stacked diffs" style.

GitHub in particular was annoying with this style but is definitely getting better. It's still not great at dealing with actual stacks of diffs, but I can (and do) work around that by keeping the stack locally and only pushing commits that apply directly to the main branch.