The release of the distributed version control system Git 2.54 has been announced. Git is known for its high performance and provides tools for nonlinear development based on branching and merging. To ensure the integrity of history and resilience against 'backdating' changes, implicit hashing of all previous history is used in each commit, along with the verification of digital signatures from developers for individual tags and commits. The Git code is distributed under the GPLv2+ license.
Compared to the previous release, the new version includes 770 changes made with the participation of 137 developers (66 of whom contributed to Git for the first time). Key innovations include:
- The implementation of the 'git history' command provides experimental capabilities for rewriting change history, which are simpler and safer to use than rebasing commits with the 'git rebase' command. Two operations are provided:
- 'git history reword ' to rewrite the message in the specified commit without changing the working directory and index (except for the note; everything else remains untouched). For example, to fix a typo.
- 'git history split ' for interactively splitting the specified commit into two different commits by moving selected parts from the original commit to an additional commit.
Future releases are expected to add additional commands: 'git history fixup' for fixing a commit, 'git history drop' for deleting a commit, 'git history reorder' for changing the order of commits, and 'git history squash' for combining commits.
- A new method for defining handlers (hooks) in configuration files has been implemented. Instead of placing handler scripts in the '.git/hooks' directory in each repository, the commands to invoke handlers can now be specified directly in the configuration files. Settings can either be bound to the repository or specified in configuration files that apply to all repositories (/etc/gitconfig) or user repositories (~/.gitconfig). Multiple handlers can be bound to a single event. Scripts from '.git/hooks' are still invoked but are executed after handlers from configuration files. To view the list of handlers, use the command 'git hook list', and to selectively disable the invocation of handlers, use the setting 'hook..enabled = false'. [hook 'linter'] event = pre-commit command = ~/.bin/linter --cpp20 [hook 'no-leaks'] event = pre-commit command = ~/.bin/leak-detector $ git hook list pre-commit global linter ~/.bin/linter --cpp20 local no-leaks ~/.bin/leak-detector
- In the 'git maintenance' command, the 'geometric' strategy is enabled by default ('git config set maintenance.strategy geometric'), which helps reduce maintenance time for large monorepositories. Compared to the previously used strategy, which utilized the logic of the 'git gc' command, the new strategy avoids repacking all objects and cuts out overly resource-intensive operations, such as merging all pack files (when possible, merging is done in parts and without cleaning up deleted objects).
- The object database (ODB) and its related APIs have been transitioned to a new architecture based on the use of plug-in backends. The restructuring abstracts the storage format of objects and will enable capabilities such as alternative backends and object formats, for example, for more efficient storage of large binary files or for optimizing the performance of large git hosting services.
- In the command 'git repo structure', which outputs information about the repository structure, not only the total size is displayed but also the largest objects of each type, allowing size evaluation without using an external tool like git-sizer. $ git repo structure … | * Largest objects | | | * Commits | | | * Maximum size [1] | 17.23 KiB | | * Maximum parents [2] | 10 | | * Trees | | | * Maximum size [3] | 58.85 KiB | | * Maximum entries [4] | 1.18 k | | * Blobs | | | * Maximum size [5] | 1019.51 KiB | | * Tags | | | * Maximum size [6] | 7.13 KiB |
- In the command 'git replay', used instead of 'git rebase' to recreate history on server a working tree, atomic reference updates are enabled by default (instead of outputting a list of update-ref commands for manual execution), the '--revert' option has been implemented to undo changes from a series of commits, empty resulting commits are discarded, and it is now possible to recreate history up to the root commit.
- In 'git rev-list' and similar commands, the '--maximal-only' option has been added to display only commits that are not reachable by other commits.
- The 'git repo info' command has been enhanced with the '--keys' option to output a list of all known keys.
- In the 'git add -p' command, while navigating between code blocks using the 'J' and 'K' keys, already approved and skipped blocks are marked. An option '--no-auto-advance' has been added to disable automatic advance to the next file, allowing a return to previous files before committing.
- The web interface 'gitweb' has been optimized for use on mobile devices.
- In the 'git apply --directory' command, file paths are normalized before use, such as './un/../normalized/path'.
- The possibility of adding custom subcommands has been documented through the placement of 'git-' files in the directory with executable files.
- The 'git send-email' command has been enhanced with support for client certificates.
- For the 'git status' command, the 'status.compareBranches' setting has been implemented, allowing you to specify branches to compare against the current branch. [status] compareBranches = @{upstream} @{push}
- In 'git rebase', the '--trailer' option has been added to simplify the addition of metadata to all commits. git rebase --trailer 'Reviewed-by: Test '
- The ability to replace signatures for commits that became invalid after import has been added to the ‘git fast-import’ command.
- Support for the compaction of multi-pack indexes (MIDX) has been added, which merges small layers of the MIDX index containing object availability information and their associated bitmap files, reducing the number of accumulated layers in long-existing repositories.
- The ‘git backfill’ command now allows specifying revisions (commit ranges) and pathspecs to limit the parts of the change history that are loaded. git backfill main~100..main git backfill — ‘*.c’
- Alternative forms of the ‘git config list’ command have been added — ‘git config -l’ and ‘git config —list’.
- The use of non-ASCII characters in command alias names defined in the configuration file is now allowed. [alias ‘fetch’] command = fetch
- The display of signatures that have expired GPG keys, but were valid at the time of signing the commit, has been changed. Such signatures are now shown as valid with a note about the key's expiration (previously they were highlighted in red, creating an impression of being invalid).
- When accessing repositories over HTTP, handling of 429 (Too Many Requests) error codes has been ensured. Requests that end with this error are now treated as a temporary issue rather than a fatal problem, with the operation to be retried after some time. The delay before retrying is set through the ‘http.retryAfter’ option, the number of retries — ‘http.maxRetries’, and the wait time — ‘http.maxRetryTime’.
Source: opennet.ru
