The upcoming Gitpocalypse
The (potential) woes of Git 3.0 switch to SHA-256
Due to bloom next spring, Git 3.0 will make SHA-256 the default hash for new repos to reduce the risk of collision attacks. GitHub co-founder Scott Chacon thinks the switch will be a train wreck instead, as many scripts and tools still expect a 40-character SHA-1 commit ID. The extra twenty-four characters have already made it into two of GitHub’s changelogs in June 2026, with CodeQL adding the 64-character IDs to its pinning check and actions/checkout fixing two places that assumed SHA-1.
When such an important piece of software gets a breaking change, a great deal of work goes into making the occasion as uneventful as possible. In his Ars Poetica, Horace pictures a mountain giving birth to a mouse to make fun of a poet who promises an epic and delivers an unremarkable story. But what makes for disappointing poetry is rather a triumph in engineering.

Why the harsh change of hash
Back in 2005, the very year Git was born, researchers found a shortcut for finding SHA-1 collisions. It took until 2017 to see one in practice. Google and CWI Amsterdam produced two PDFs that showed different pages when you opened them and gave the same SHA-1 hash when you checked. By 2020, researchers could start with two different prefixes of their choosing and still make the hashes match.
For Git, the worry is what happens when two objects get the same name. The hash is what Git uses to look up an object, so a collision leaves it with one key for two things. After the PDF demonstration, Git adopted a hardened version of SHA-1 that detects known collision techniques. SHA-256 gives Git a much larger space for object IDs and makes it more resilient to the weaknesses researchers have found in SHA-1.
Besides generating commit IDs, Git uses cryptographic hashes to identify file contents, directory trees, and annotated tags. It uses the same algorithm for the checksums of packfiles and their indexes. In new repos, all of those hashes will switch from SHA-1 to SHA-256 by default.
The fuss over Git 3.0 makes SHA-256 sound like a last-minute addition to the release, but it has been decided since 2018, and you’ve been able to create repos with it since 2020. What people are bracing for now is the day git init starts making that choice for them.
Will it be a costly mistake?
Chacon argues that the switch will “cost everyone a lot of time and angst for little benefit.” His point is that the SHA-1 Git uses today already has some protection. The PDF researchers could design both inputs together. Replacing a file that’s already in a repository means matching a hash that’s already fixed, which is a much harder job.
In his proposal to the Git mailing list, Chacon suggests keeping SHA-1 object IDs and adding a SHA-256 checksum to signed commits and tags. That would let you verify a signed snapshot with a stronger hash. Git would still store and look up the underlying objects by their SHA-1 IDs.
One example of how this can break comes from a bug report about deleting a branch: Git sends the pre-push hook an all-zero ID to tell it that the branch is being deleted. The hook in pre-commit expected forty zeros, so when it got sixty-four, it tried to run a diff against a commit that didn’t exist.
A local test with Git 2.56.1 put that same forty-zero check in a small pre-push hook. Both deletions went through. The hook reported the difference.
sha1
delete: 40 zeros, 40-zero check matches
sha256
delete: 64 zeros, 40-zero check misses
The hook can look for (delete) in the ref field. Somebody still had to think to delete a branch, see the error, and work out why it was trying to run a diff. By the time you upgrade Git, their work may have reached you as a routine dependency update.
But wait, there’s more!
Version 3.0 also plans to make reftable the default storage format for branches and tags in new repos. Today, refs can live in individual files under .git/refs or share a file called packed-refs. Deleting one entry from that shared file means rewriting the whole thing. Reftable stores refs in binary tables and can record a deletion separately.
The object format is a separate setting. A release script that reads packed-refs directly could miss a tag in a reftable repo even if the object IDs are still forty characters long. For a script that just needs the list of tags, git for-each-ref refs/tags/ works with either storage format.
For those who build their own Git binaries, 3.0 is slated to add Rust to the build requirements. In September, the maintainer of Git’s HPE NonStop port said Rust support was unlikely to be ready in time for 3.0. The roadmap leaves room to delay the requirement if it causes significant problems for distributors.
What to check before the upgrade
Existing repos keep their object format. You’re more likely to run into the change in a script that reads a commit ID or creates a checkout for you. A script can pass every day against a SHA-1 repo and fail the first time it receives a full SHA-256 commit ID.
These are the parts of your tooling worth a closer look.
- Scripts that read commit IDs: Check for validators, fields, or string slices built around forty characters. Give them a real 64-character ID and see whether they reject it or cut it short. Widen the field or update the check wherever both formats can reach it.
- Scripts that build a checkout: If a job initializes a repo and then fetches, test that sequence against the remote it actually uses. Use
git cloneif it fits the job, or tellgit initwhich object format to use. In one case,pre-committried to fetch SHA-1 hooks into a SHA-256 repo. - Pre-push hooks: Try deleting a branch in a disposable SHA-256 repo. A hook can look for
(delete)in the local ref field instead of counting the zeros in the object ID.
You can create repos in either format to try it out:
git init --object-format=sha1 test-sha1
git init --object-format=sha256 test-sha256
Once there’s a commit in each repo, git rev-parse HEAD gives you an ID to try with the same script.
Most people will just ask an AI assistant of their choice to look through their CI workflows and the scripts they call. The answer can point to the exact line behind each finding and suggest a test to run with the version of Git used in CI.
And if all this talk of a Gitpocalypse turns out to be much ado about nothing, so much the better. Let’s root for the birth of a mouse.