Recently, the open-source Git project released its latest version 2.40, bringing some new features and bug fixes. Highlights of this release include updates to the git jump
tool, enhancements to cat-file
tool, and faster response on Windows.
Taylor Blau, staff software engineer at GitHub provided a detailed walkthrough of the updates in Git 2.40. git jump
, an optional tool in Git's contrib directory, now supports Emacs and Vim. The git jump
tool works by wrapping Git commands, such as git grep
, and feeding their results into Vim's quickfix list.
If you are using Emacs, git jump
can be used to generate a list of locations using the command M-x grepgit jump --stdout grep foo
. The command will then show all matches of "foo" in your project, enabling easy navigation. Git jump also works with diff
and merge
.
Git's cat-file
tool is commonly used to print out the contents of arbitrary objects in Git repositories. With Git version 2.38.0, cat-file
tool got support to apply Git's mailmap rules when printing out the contents of a commit. To understand the size of a particular object, --batch-check
and -s
options were used with cat-file
tool. However, the previous versions of Git had an issue causing incorrect results when using the --use-mailmap
option with the cat-file
tool in combination with the --batch-check
and -s
options. With Git 2.40, this has been corrected, and the --batch-check
and -s
options will now report the object size correctly.
The git check-attr
command is used to determine which gitattributes
are set for a given path. These attributes are defined and set by one or more .gitattributes
files in a repository. For complex rules or multiple .gitattributes
files, check-attr
git command was used:
$ git check-attr -a git.c
git.c: diff: cpp
git.c: whitespace: indent,trail,space
Previously, check-attr
required an index to be present, making it challenging to use in bare repositories. A bare repository is a directory with a .git
suffix without a locally checked-out copy of any of the files under revision control. Now in Git 2.40 and newer versions, there is a support for --source=
option to scan for .gitattributes
in, making it easier to use in bare repositories.
GitHub's Twitter handle posted the highlights, which caught the attention of the tech community on Twitter. One of the Twitter users Andrew retweeted the announcement with a quote, "git jump seems pretty useful! https://github.com/git/git/tree/v2.19.0/contrib/git-jump"
Git 2.40 also includes improvements to rewrite old parts of Git from Perl or Shell to modern C equivalents. This allows Git commands to run faster on platforms like Windows. Now, git bisect
is now implemented in C as a native builtin and the legacy implementation git add --interactive
has been retired.
There are some improvements to Git’s CI infrastructure in version 2.40. Some long-running Windows-specific CI builds have been disabled, resulting in faster and more resource-efficient CI runs for Git developers.