Top
Best
New

Posted by chmaynard 15 hours ago

Looking forward to Git 2.56 – and 3.0(lwn.net)
171 points | 94 comments
jodersky 7 hours ago|
It's unfortunate that change IDs aren't considered. There was a discussion [1] in 2025, and it has resurfaced a couple of times since.

Basically, the idea is to attribute a new kind of ID to an initial 'change'. During review, or whenever a commit is rebased, the change ID is kept, whereas the commit of course changes. This allows tooling to identify all previous versions of a change, and is what enables "per-commit" code review à la Gerrit [2] (which IMO is a much better experience than the branch-review-squash model that GitHub normalized). It's also used in jj, although I'm not familiar with that.

As of today, any tool that wants a change ID needs to somehow encode it in commit message bodies. The proposed discussion was about making a change ID a standard header field that git would natively keep across rebases.

[1] https://lore.kernel.org/git/Z_OGMb-1oV0Ex05e@pks.im/T/#mf941...

[2] https://gerrit-review.googlesource.com/Documentation/user-ch...

schacon 5 hours ago||
JJ and GitButler already create and inject this into the commit headers (using the same interoperable reverse-hex format), which is recognized by Gerrit and some forges like Tangled for incremental commit based review.

I doubt that core Git will adopt it anytime soon as it was not discussed at this years contributor summit (last week) and doesn't seem to be a hot topic on the ML.

What I would like to see is support for `git rebase` not dropping it, which is the current main issue. The `git replay` command, as well as commands based on the same sequencing code (`git history` for example) do not drop custom headers like this, so there is partial non-breakage, but several of the other history editing commands do drop custom headers.

stabbles 5 hours ago|||
Yeah, "standardizing" change IDs would make it much easier to develop further tooling around it. In particular decentralized review is something that I'd be interested in.

For example, if GitHub is down, that would not be a blocker to access review comments or to do reviews. And maybe you could push your reviews to a GitLab mirror if you want a UI.

nickserv 2 hours ago||
> if GitHub is down

Surely you mean when GitHub is down.

As an aside, I thought it a bit worrisome that the move to Sha256 is apparently delayed due to GitHub dragging their feet on this.

ncphillips 6 hours ago|||
Having switched to jj I totally agree. Change IDs are a huge UX win.
lostmsu 3 hours ago||
How is this different from branches?
ikawe 2 hours ago|||
A branch is mutable and holds only one version of history at a time.

If you never rewrite history, you could achieve something similar, but it precludes you from having a “tidy” branch.

Whether or not you’re into rewriting history is a different discussion that has been hashed out over and over again.

jodersky 27 minutes ago||
Another thing that becomes easier with change IDs is reviewing multiple related commits together, essentially "stacked pull requests".

If you treat a branch as your unit of review, then it becomes super difficult for someone to submit a chain of related changes. You'll be constantly rebasing your pull requests onto each other as you get feedback from dependent branches.

I heard that the github CLI recently introduced support for this, but since in git there's no concept of dependent branches (a branch isn't even an object in git, just a reference to a commit), I think this approach will always be clunkier than reviewing commits related by a change ID.

PunchyHamster 4 minutes ago||
> The Git 2.45 release added reftables as a more efficient way of storing refs. It is a binary file optimized for both space efficiency and quick access. Since then, it has been possible to create a repository that uses a reftable rather than the old file-based mechanism, but that has never been the default. Switching to reftable should have no visible consequences (other than better performance) for users of Git itself, but it can be a problem for users of other software packages that access Git repositories. In his email, carlson mentioned libgit2 as a potential concern.

Looking forward to losing all references at once vs just the current one...

I've noticed persistent Git/fs interaction where on crash the current ref can just disappear...

harrouet 2 hours ago||
It seemed obvious to me that the next version number after 2.56 would be 5.12
notpushkin 6 hours ago||
> Try LWN for free for 0 month: no payment or credit card required.

Quite a generous offer!

</aside>

jakub_g 3 hours ago||
I'm looking forward to reftable to become the default. It solves many problems with branches, like branches with weird characters created with non-standard clients making a fetch impossible; case insensitive branches with "same" names doing the same; or impossible to create branch FOO because FOO/Something exists.

All those problems just go away when branches are no longer files on disk.

I enabled it in setup script of one large repo I maintain; the main issue is the incompatibility with some people's personal tooling based on libgit2 (some git status tooling in oh-my-zsh), but people do find workarounds.

moebrowne 7 hours ago||
It appears that BitBucket also does not currently support SHA256 hashes.

https://jira.atlassian.com/browse/BCLOUD-23729

WCSTombs 14 hours ago||
`git add --resolved` is a wonderful idea, and definitely something I would start using.
KolmogorovComp 14 hours ago||
Does it mean that when switching trop sha1 to sha256 you need to forcepush and rewrite all history? Wouldn’t that be a massive source of potential vulnerabilities?
schacon 5 hours ago||
It's much, much worse than that.

Yes, you do need to do that. However, there is also much more work after that.

Git will not intermingle SHA-256 and SHA-1 enabled repositories, even in things like submodules, so anything used in that manner will need to keep both versions into the indefinite future. If you rely on a submodule that has not yet converted, you will have to convert it yourself and try to keep it up to date, or the forge will have to automatically keep a bidirectional mirror (if you have submodules in various forges, you'll have to wait for all of them to do it), etc.

This means that every SHA referenced anywhere on the internet, in commit messages, in issues, in code comments is now invalid and needs a mapping to find the rewritten one for forever.

It also means that every commit signature ever made is now invalid and will probably have to be stripped from the rewritten new 256 history because it's impossible to resign everything.

Companies like Google and GitHub are working on keeping two versions of each repository so that there can be long stages of ecosystem migrations, but no matter what, it's going to be a huge pain for millions of developers for years to come.

nextaccountic 10 hours ago|||
That's odd. Why not compute both sha1 and sha256 for all git objects for the foreseeable future?

Failing that, have a kind of git object that wraps another and says hey this is in sha1 don't mess with it

em-bee 13 hours ago|||
i guess that for now only the default will change for new repositories. support for sha1 is not going to be dropped, so most existing repositories won't switch any time soon. if you want to switch then yes, it sounds like a force push might be needed, although it could also be that simply switching is not possible, but that instead you have to create a new repo and import the history from the old repo, forcing everyone to clone the new repo intentionally.
infogulch 11 hours ago|||
Couldn't you write something that checks every commit's content and message is byte equal to the old tree? One scan through the history to verify it should be relatively simple if not cheap. Should be built into git.
nomel 14 hours ago||
I don't know much about this. How does that enable vulnerabilities exactly?
jayd16 14 hours ago||
Trusting a forced push w/o any other verification means nefarious history changes can be slipped in.
wtfwhateven 13 hours ago|||
Semi-relevant-ish: https://blog.citp.princeton.edu/2013/10/09/the-linux-backdoo...
vlovich123 11 hours ago|||
You can still verify the contents - the content blobs don’t change after the migration. Not sure if there’s a practical attack one could do but maybe
awesome_dude 8 hours ago||
Um. how do you verify the contents? The history is for the contents you now have, not what might have been
jayd16 1 hour ago||
Shallow clones and such would break but you could rehash the local history manually and compare the SHA256 hashes commit by commit, no?

Issue is it would be pretty slow so you'd want it to be a one time thing.

GTP 4 hours ago||
Why not transitioning to SHA3 directly? IIRC lenght extension attacks are not currently feasible on SHA2, but still theoretically possible.
cesarb 3 hours ago|
Length extension attacks are not an issue for git, because every object has two fields in its header, which is prepended to the object before hashing: the object type and the length in bytes.
GTP 7 minutes ago||
Interesting. Anyway, since they're going through the pain of changing the hash function, why not using the latest standard? SHA3 has been standardized for some time now, and using SHA256 isn't any easier than using SHA3-256.
lolakutty 5 hours ago|
Will we ever get integer commit references like we have in mercurial ?
irishcoffee 3 hours ago|
I will always mourn hg losing to git in the DVCS wars, however it was generally considered bad practice to rely on the integer commit references.
lolakutty 3 hours ago||
Why, because it shifts?

That is not a problem for local use + constant repo state.

PunchyHamster 3 minutes ago||
so it is a problem for majority of use
More comments...