After two months of development, the release of the distributed version control system Git 2.51 has been presented. Git is known for its high performance and provides tools for non-linear development based on branching and merging. To ensure the integrity of history and resistance to 'backward' changes, implicit hashing of the entire previous history in each commit is employed, along with digital signatures from developers on individual tags and commits. The Git code is distributed under the GPLv2+ license.
Compared to the previous release, the new version includes 506 changes made with the participation of 91 developers (21 participated in Git development for the first time). Key innovations (1, 2, 3):
- The performance of the 'git push' and 'git fetch' commands has been improved in repositories with a large number of references. This acceleration is achieved through batch updates of links, where multiple references are processed in a single transaction instead of creating a separate transaction for each reference update. This optimization has significantly increased the performance of the 'reftable' backend, which now surpasses the performance of the 'files' backend. For example, in a test repository with 10,000 references, the performance of 'git fetch' using the 'reftable' backend increased by 22 times, while using the 'files' backend saw a 1.25 times improvement. For 'git push', the gains were 18 and 1.21 times, respectively.
- A new method has been proposed for packaging parts of the repository in pack files, which are not associated with unreachable objects that are not referenced by branches or tags in the repository. Information about unreachable objects is stored in separate pack files ('cruft packs'), which necessitated their reflection in multi-pack indices (MIDX) to encompass objects that were initially unreachable and stored only in cruft packs but later became reachable after a referring commit.
The new version ensures the preservation of additional copies of reachable objects stored only in cruft files when repacking pack files. This change guarantees that the set of pack files used to store reachable objects does not contain objects referencing other objects stored outside of that set. To exclude unreachable content from multi-pack indices (MIDX) in cruft files, a setting called 'repack.MIDXMustContainCruft' has been proposed, significantly reducing the size of such indices. Enabling this setting in the GitHub repository allowed for a 38% reduction in MIDX index size, a 35% speedup in writing to MIDX indices, and a 5% improvement in read performance.
- The 'git pack-objects' command has been enhanced with the '--path-walk' option, which introduces a new method of gathering object information when repacking pack files. Instead of traversing objects in the order of revisions, the '--path-walk' mode iterates objects through file path traversal, allowing for the simultaneous packing of all objects with the same file path. This approach eliminates the heuristic using hashing to determine the relationship of an object to its file path, as well as the need to sort objects before packing. Using the '--path-walk' mode results in significantly smaller generated pack files than grouping objects using hashes.
- A format has been defined for exchanging saved states of the working directory and indices in the repository, created using the 'git stash' command. The new format allows for encoding saved changes (stash entries) as a sequence of commits. The 'git stash import' and 'git stash export' subcommands have been proposed for importing and exporting these saved states, enabling the transfer of states between systems and performing push or pull operations with these states as if they were regular branches or tags. git stash export --to-ref refs/stashes/my-stash git push origin refs/stashes/my-stash … git fetch origin '+refs/stashes/*:refs/stashes/*' git stash import refs/stashes/my-stash
- In the 'git cat-file' command, which outputs the contents of specified objects, the ability to display information about missing objects (for example, due to repository corruption) and submodules has been implemented when using the '--batch' and '--batch-check' options. Previously, when specifying a path to a submodule, the 'git cat-file --batch-check' command would output 'missing', but now it will show the object's ID.
- The 'git log' command now utilizes optimizations based on Bloom filters to speed up searching through the history of changes when specifying filters with multiple file paths, e.g., 'git log -- path/to/a path/to/b'.
- The 'git switch' and 'git restore' commands, which have been considered experimental since 2019, have been stabilized. These commands are presented as modern equivalents of 'git checkout', separating the loosely related functionalities of this command, such as branch manipulation (switching and creating) and restoring files in the working directory.
- The command 'git whatchanged', equivalent to 'git log --raw', has been deprecated and is scheduled for removal in Git version 3.0.
- The 'git for-each-ref' command has added the '--start-after' option, which can be used in conjunction with the '--count' option for paginated output.
- The 'git merge' and 'git pull' commands now include the '--compact-summary' option for using a compact summary format of the changes instead of the diffstat format.
- The Git codebase now allows the use of the 'bool' keyword introduced in C99 standard. Some C99 features that are experimentally utilized in Git have also been documented (for example, in mid-2026, the use of constructions like '(struct foo){ .member = value };' is planned to be allowed). A C99-compliant compiler is mandatory for Git from 2021, but features of the C99 specification are being implemented very cautiously to maintain compatibility with compilers that partially support this standard.
- The patch acceptance rules have been amended to allow the submission of patches under a pseudonym, rather than only under the developer's real name. This change aligns with the patch acceptance rules in the Linux kernel.
- The list of compatibility-breaking changes that will be applied in the Git 3.0 branch has been updated. Notable changes in the upcoming Git 3.0 release include the default transition to object IDs based on the SHA-256 hashing algorithm when initializing new repositories and the use of the 'reftable' format for storing references to branches and tags in the repository (utilizing block storage from the JGit project, optimized for handling a very large number of references).
Source: opennet.ru
