Git 2.51, explained: cruft-less MIDX, path-walk packs, stash interchange, and the road to Git 3.0

Última actualización: 08/21/2025
  • Cruft-free MIDX: new repack behavior plus repack.MIDXMustContainCruft yields smaller, faster multi-pack indexes.
  • Path-walk packing: the --path-walk mode often creates significantly smaller packs with competitive timings.
  • Stash interchange: export/import stash entries via refs to move work safely between machines.
  • Tooling & roadmap: improved cat-file and Bloom filters; switch/restore stabilized; prep for Git 3.0 (SHA-256, reftable).
Git 2.51

Git 2.51 is now available, bringing a broad set of performance and usability refinements contributed by more than 91 developers, including 21 first-time contributors. This release focuses on storage efficiency, faster reads in large repositories, and better ways to move work-in-progress across machines without jumping through hoops.

Key themes include cruft-free multi-pack indexes, a new path-walk packer, and a stash interchange format. You’ll also find steady progress toward stronger cryptographic defaults (SHA-256) and future changes slated for Git 3.0, plus pragmatic polish to everyday plumbing and porcelain.

Cruft-free multi-pack indexes

Git 2.51 features

Large repositories rely on packfiles and MIDX (multi-pack indexes) to resolve objects quickly. Historically, unreachable objects landed in “cruft packs” and were meant to stay out of the MIDX. But if a once-unreachable object later becomes reachable and sits only in a cruft pack, it can break bitmap assumptions and slow things down.

Git 2.51 changes how non-cruft packs are built: during repack, Git now ensures that objects whose only other copy is in a cruft pack are duplicated into the non-cruft set, making that set closed under reachability. In practice, this enables smaller and faster multi-pack indexes without sacrificing correctness.

A new configuration, repack.MIDXMustContainCruft, activates this strategy, storing cruft packs out of the MIDX while keeping lookups fast. GitHub reports tangible wins from this approach in a large monorepo: MIDX size shrank by ~38%, writes were ~35% faster, and read performance improved by about 5%.

If your monorepo MIDX has grown unwieldy, try a repack with the new setting and measure lookup and traversal gains in your CI and developer workflows.

Smaller packs with path walk

Git 2.51 improvements

Choosing good deltas is the heart of compact packfiles. Earlier releases introduced a revised name-hash to improve delta pairing, but Git 2.51 goes further with a “path walk” mode that groups and emits all objects from the same path together, bypassing name-hash heuristics entirely.

In many repositories, path walk produces notably smaller packs while staying competitive in runtime versus traditional revision-order traversals. It’s especially effective when you have many versions of the same files evolving along consistent paths.

To experiment with it during repack, use the new option on pack-objects: --path-walk. For teams pushing pack sizes to the limit, this can reduce network transfer and local storage in one go.

Stash interchange format

Moving stashes between machines has been awkward because stash commits are hidden behind a single refs/stash. Git 2.51 introduces a variant that represents multiple stash entries as a sequence of commits linked together, so they behave more like a regular log.

With that design, you can export and import stashes via ordinary refs, push or fetch them like branches or tags, and preserve work-in-progress across environments without ad-hoc patches or tarballs.

Example workflow to share a stash:

$ git stash export --to-ref refs/stashes/my-stash
$ git push origin refs/stashes/my-stash

# On another machine
$ git fetch origin '+refs/stashes/*:refs/stashes/*'
$ git stash import refs/stashes/my-stash

This approach keeps your scratch work organized and auditable, especially in cross-device setups or when handing off WIP to a teammate.

Sharper plumbing and everyday ergonomics

cat-file gets smarter in batch modes: when asked about a submodule path, pre-2.51 builds often returned “missing”. Git 2.51 now reports the object type more usefully (e.g., “submodule”), which helps scripts that need to reason about repository contents at scale.

Changed-path Bloom filters now help with multiple pathspecs (e.g., git log -- a b), broadening the cases where history traversals can skip commits confidently. That’s a practical speed boost for common review and investigation patterns.

git switch and git restore graduate from experimental. Introduced as clearer, purpose-built alternatives to the multi-role git checkout, their CLI is now considered stable going forward.

git whatchanged is deprecated and slated for removal in Git 3.0. If you still rely on it, it remains callable behind the aptly named --i-still-use-this flag while you migrate to git log --raw.

Toward Git 3.0: defaults and testable breaking changes

The project continues preparing for SHA-256 and the reftable reference backend to become defaults in Git 3.0. In Git 2.51, repositories are still created with SHA-1 by default, but more internal plumbing understands SHA-256, easing experimentation and integration work.

If you want a preview of tomorrow’s defaults, you can build with WITH_BREAKING_CHANGES to try the incoming behaviors in controlled environments. Hosting providers and tooling authors can use this to surface edge cases ahead of the major switch.

The dual goal remains clear: strengthen the cryptographic base and modernize references, while maintaining backward compatibility for the vast ecosystem built on Git’s current assumptions.

Language and process updates

On the implementation side, C99 adoption continues methodically. The project now permits the bool keyword throughout the codebase and documents which C99 features are in use or under evaluation, keeping portability in mind for a wide compiler matrix.

Contribution guidelines got an inclusive update: patches no longer have to be submitted under a contributor’s legal name, aligning Git’s policy more closely with the Linux kernel and supporting contributors who prefer alternative identities.

How to try the headline features today

Enable the cruft-less MIDX strategy to slim multi-pack indexes and speed reads:

$ git config --global repack.MIDXMustContainCruft true
$ git gc --cruft --aggressive

Repack with path walk to evaluate pack size and runtime differences:

$ git repack -ad
$ git pack-objects --path-walk --revs --stdout < .git/objects/pack/pack-list.txt > new.pack

Share a stash across machines with the new export/import subcommands:

$ git stash export --to-ref refs/stashes/feature-wip
$ git push origin refs/stashes/feature-wip

All told, Git 2.51 is an evolutionary release that pays off in everyday use: faster, leaner object management; practical improvements for scripting and history queries; a cleaner stash workflow; and steady progress toward the Git 3.0 era where SHA-256 and reftable become the norm.

Git 2.51
Artículo relacionado:
Git 2.51 lands with cruft-less MIDX, path-walk packs, stash import/export and 3.0 groundwork
Related posts: