
Git, the open-source distributed version control system, has released version 2.56.0. This release involved contributions from over a hundred developers , thirty of whom are new contributors to the project. The new release includes a set of improvements that affect everyday tasks such as conflict resolution, optimization of operations in large repositories, and reference management.
In the following lines, we'll review the most relevant new features in this update. Many of them are designed to facilitate the daily work of maintainers and reduce execution time in large repositories, a critical aspect in professional development environments.
A safer way to mark conflicts as resolved in Git 2.56
When a conflict occurs during a merge, the process has two phases: first, the working tree is edited until each conflicting file is as desired, and then those paths are prepared to tell Git that the conflict has been resolved. The problem is that commands like git add -u They update all modified routes that are being tracked, which may include local changes unrelated to the conflict or even files that still contain conflict markers.
To avoid these oversights, Git 2.56 incorporates git add --resolved. This way Consider only the routes that are currently not merged in the index. Before preparing anything, it checks regular, unmerged files for residual conflict markers. If it finds any, it reports the affected paths and leaves the index intact. Additionally, a path pattern can be passed to it to limit which unmerged files are considered, and the marker check is applied globally to the selection: if any selected file contains markers, it is not prepared. Resolved deletions and binary conflicts, lacking text markers, can be prepared normally.
This option is deliberately more restrictive that git add -u o git add -AIt cannot be combined with them and ignores tracked files that were never in conflict. It is useful as a safety net in workflows where a merge might start with unrelated local changes already present.
The merge-base algorithm stops searching earlier
Many Git operations require locating the best common ancestor of two commits. Merges use them as a starting point to combine changes, and three-point diverges use a common ancestor to decide where the work on a topic branch begins. Repository servers perform the same calculation for pull request diverges, merge checks, and revision ranges.
Git finds these ancestors by walking backward from both ends. Imagine commits reachable from one side are colored blue, and those from the other are colored red. A commit reachable from both colors is a merge base candidate. Finding a candidate isn't always enough: cross-merges can produce multiple merge bases, none of which are ancestors of each other, so Git must keep walking until it knows it has found them all. The previous stopping rule could continue processing a long queue of stale and common history after another merge base had become unreachable.
Version 2.56 keeps track of how many queued commits remain, written exclusively by each side . Once an exclusive side is exhausted, no new merge point can appear, so Git can stop while still returning all merge bases. The difference can be significant when older side branches have been merged into a much longer history. In a real-world case of a single repository, the traversal time dropped from 0,68 seconds to 0,01 seconds. Production testing on two large single repositories found many instances where one was around 70 times faster and the other saw an average improvement of about 20 times.
Path-walk now supports bitmaps and delta islands
When Git repackages a repository, it looks for similar objects that can be efficiently stored as deltas. Traditional searches group candidates using a name hash. Path-walk repackaging, on the other hand, visits objects by their location in the tree, bringing together versions from the same path and often finding better delta relationships. The potential storage savings are substantial. In a test with a recent clone of the Fluent UI repository and forcing Git to recalculate deltas, an ordinary repackage using bitmaps produced a 558,5 MB package. Repackaging with --path-walk It generated a 164,4 MB package, approximately 71% less.
However, repository servers need more than just small packages. They often use reachability bitmaps to quickly respond to object enumeration queries, and some employ delta islands to prevent objects in one reference group from depending on objects available only in another. Path-walk repackaging was incompatible with both of these things, limiting where their storage improvements could be deployed. Git 2.56 removes both of these restrictions.
A repackaged path-walk can now select commits for a new bitmap. Subsequent invocations of git pack-objects They can reuse an existing bitmap when responding to a request, resorting to path-walking only when necessary. Path-walking now also performs the accounting required by delta islands: it propagates island membership across commits and trees before electing delta bases. This allows servers to preserve their isolation rules while experimenting with the smaller disk representation of path-walking. These changes do not enable path-walk repackaging by default, but they do remove two significant adoption blocks.
Git 2.56 introduces new tools and internal improvements
The experimental command git history It continues to grow. Git 2.54 introduced it with reword y split, and Git 2.55 added fixupGit 2.56 now incorporates git history dropThis command removes the selected commit and reapplies its descendants over the parent commit. If HEAD is moved, Git updates the index and working tree, preserving unrelated local changes. It aborts if reapplying a descendant would cause conflicts or overwrite a local change. The command remains experimental. It cannot operate on a history that contains mergers. and cannot delete a root or merge commit.
The commands for writing references have been scattered among git update-ref, git symbolic-ref and other plumbing tools. Git 2.56 continues to consolidate low-level reference management under the umbrella of git refs: create, update, delete y renameThe optional legacy values ​​provide compare-and-swap protection for updates and deletions. These are deliberately low-level commands; in particular, git refs rename It moves the reference and its reflog, but it doesn't perform the branch configuration adjustments that it does. git branch -m.
Cleaning up local topic branches after your work reaches the main branch can involve comparing each branch to its configured remote tracking branch. Git 2.56 adds a way to do this in bulk: git branch --delete-merged 'origin/*' 'topic-*' --dry-runIn this command, origin/* coincides with branches whose upstream is under origin, topic-* It limits candidates to local branch names that begin with topic-, and --dry-run List what would be deleted without deleting anything. When run without --dry-runGit removes only branches whose tips are reachable from their corresponding upstreams. Branches pulled into a working tree, branches with missing upstreams, and various ambiguous push configurations are omitted. The option branch..deleteMerged = false can protect a branch from mass cleaning.
git bisect run It is very effective at finding the commit that introduced a regression, but upon completion it usually leaves the user on the culprit commit until they run git bisect resetThe new option --reset-when-found[=] Combine those steps. Its default value is original, which returns to the confirmation that existed before the bisection began; found It cleans up the bisection state but leaves the guilty confirmation extracted. The option is not available with --no-checkout.
The experimental command git replay You can now flatten the topology of merges with --linearizeGit reapplies commits in a single line and discards merge commits, matching the topology produced by git rebase --no-rebase-mergesbut without using the work tree. This option cannot be combined with --contained nor by reapplying multiple branches at once.
Git can now recognize two easy typos on the command line and suggest the intended form. Run git push origin/main advises using git push origin mainWhile git branch --set-upstream-to origin main sugiere git branch --set-upstream-to=origin/mainGit checks that each correction be plausible before suggesting it, avoiding indiscriminate conjectures.
Partial clones omit initially selected objects, but blobs obtained on demand have traditionally remained stored locally indefinitely. Git 2.56 can discard large, recoverable blobs and rely again on the remote promisor. git repack -a --filter=blob:limit=1m --drop-filtered --dry-run and then without --dry-runDry testing lists the candidates; actual repackaging removes them locally so that subsequent access will have to search for them again. It's a manual cleanup mechanism, not an automatically bounded cache, and currently only supports filters. blob:limitGit requires a remote promisor and rejects unsafe cases How to discard an object referenced by the current index. This work was contributed as a GSoC project by Siddharth Shrimali, with Christian Couder and Siddharth Asthana as mentors.
git log --follow Now you can more reliably track a path through a non-linear history. Previously, the command maintained a single global "current path." If different parents renamed the path differently, the side visited first could determine what Git followed for the rest of the traversal. Git 2.56 records the route separately for each parentmaking the result independent of the traversal order and correcting cases such as subtree merges.
Multi-rooted charts can place an unrelated commit directly below a root commit in the same column, making them appear connected. Git 2.56 indents these "visual roots" when necessary. This is enabled by default for git log --graph. Uses --no-graph-indent for legacy rendering, or configure log.graphIndent to choose a default value.
Several internal changes eliminate scaling cliffs in otherwise ordinary operations. Writes to reftable now avoid redundant reloads after taking the lock, making filesystem statistics calls constant rather than linear with the number of references. Loading known new packages no longer scans the existing list before each insertion, eliminating an O(N²) regression that caused a prompt-related command to take 4,5 seconds on a repository with 37.815 packages.
Other changes eliminated quadratic scans of reftables with many graves and path-limited working tree differences, while untracked file collection is now robustly O(n log n) instead of relying on an already sorted input. Grave performance tests on reftables dropped from about 13 seconds to 0,2 seconds. On a Chromium copy with approximately 500.000 index entries, a git diff The affected person improved from about eight minutes to 0,07 seconds.
Git version 2.56 is presented as an update focused on security and performance. Tools such as git add --resolved They reduce the risk of errors. When preparing for conflicts, optimizations in common ancestor finding and path-walk repackaging aim to alleviate the workload in large repositories. This is complemented by improvements in reference management, branch cleanup, and command correction, along with significant advances in internal efficiency that translate into much shorter execution times. All of this makes for a release that, without changing the basic user experience, lays a more solid foundation for the future of the project.
Table of Contents