The release of the distributed version control system Git 2.56 has been announced. Git is distributed under the GPLv2+ license. Compared to the previous release, this new version includes 748 changes, prepared with the participation of 104 developers, 39 of whom participated in Git development for the first time. Key innovations (1, 2, 3):
- A 'git add --resolved' mode has been added for resolving merge conflicts, which checks files for conflict markers and, upon detecting a marker in at least one file, returns an error, does not index any of the files, and shows a list of files that require fixing. Unlike the 'git add --update' command, this new mode only processes files that are in a conflict state, ignoring modified files not related to the conflict, allowing safe completion of branch merges even if other uncommitted changes are present in the working directory (the 'git add --update' command added all previously tracked modified files in the working directory to the index).
- Significant speed improvements have been made when working with large repositories, thanks to optimization of the algorithm for finding the latest common commits during branch merges and commit comparisons. The process now considers commits that belong exclusively to one of the branches, which allows scanning to stop as soon as all possible common ancestors are found, saving time on further traversing the history of changes. In one of the tested repositories, search speed increased on average by 20 times, while in another, the speedup reached 70 times. When executing the 'git merge-base --all v4.8 v4.9' command in a repository with the Linux kernel, the number of traversal steps decreased from 167,000 to 3,800.
- For server applications, the '—path-walk' repacking mode has been adapted, allowing for the creation of more compact pack files by grouping objects by their paths in the directory tree (for example, for the Fluent UI repository, using '—path-walk' reduced the pack file size from 558 MB to 164 MB). The new version also implements the ability to use the '—path-walk' mode along with reachability bitmap and delta islands, which are used by Git hosting services to speed up operations and isolate forks from the main repository.
- Bottlenecks that led to excessive computations in large repositories have been addressed: unnecessary file status checks during writes to the reftable have been removed; redundant scanning of the list during each insertion of a new pack file has been eliminated; operations involving a large number of deletion records in the reftable have been accelerated; the performance of 'git diff' with path restrictions has been optimized. Following these optimizations, working with the reftable during numerous deletions has sped up by 65 times (from 13 seconds to 0.2 seconds), and executing the problematic 'git diff' command in the Chromium repository with 500,000 items in the index now takes 0.07 seconds instead of 8 minutes.
- An experimental command 'git history', which provides capabilities for rewriting change history, has added the 'git history drop' operation to remove a selected commit while automatically attaching its descendants to the parent commit.
- The command 'git branch —delete-merged ‘origin/*’ ‘topic-*'’ has been introduced for safe deletion of groups of local branches whose changes have already been pushed to the external repository. Masks are allowed for filtering branches and repositories. To analyze candidates for deletion without actually performing the operation, the ‘—dry-run’ flag can be utilized.
- The command 'git refs create|update|delete|rename' has been added, combining low-level operations for creating, deleting, renaming, and updating references.
- The 'git bisect run' command has been enhanced with the ‘—reset-when-found=[]’ option, which automatically returns the repository to its state prior to the search or keeps the problematic commit active, eliminating the need for a separate execution of the 'git bisect reset' command.
- The 'git replay' command has introduced the ‘—linearize’ flag for using a flat merge topology, similar to 'git rebase —no-rebase-merges', but without referencing the working tree.
- In the command 'git log —follow', tracking of file renames in a non-linear change history has been implemented, such as when merging branches. The file path is now recorded separately for each parent commit, making the result independent of the order in which the commit history is traversed.
- The command "git repack -a --filter=blob:limit=1m --drop-filtered" has been added to remove large blob objects that were uploaded on demand from an external repository and are not used in the current index. When accessing these objects in the future, they will be automatically reloaded.
- In the command "git log --graph", indentation has been implemented for graphs with multiple independent roots to clearly separate unrelated commits.
- Common typos have been identified, such as using "git push origin/main" instead of "git push origin main" or "git branch --set-upstream-to origin main" instead of "git branch --set-upstream-to=origin/main", with prompts provided for the correct usage.
Source: opennet.ru
