MMS • RSS
Article originally posted on InfoQ. Visit InfoQ
The latest release of Git brings a wealth of new features and internal changes, including improved
grep, better command line completion, a new
range-diff command, and more.
diff is now able to correctly mark as new the path of files added with
intent-to-add bit can be used with the
git add command, e.g.,
git add --intent-to-add <file>, to add an empty file to the working tree. This is mostly useful so
git diff will show the full content of the new file in its output. Previously, though, the file path in a diff was not marked as new. On a related note, the
apply command too has improved its handling of the
intent-to-add option. Indeed, it now adds new paths to the index when applying a patch that only affects the working tree for all new files added with
intent-to-add. Jumping back to
color-moved option has been extended to support a new
color-moved-ws variant, which specifically makes
git diff color lines that were moved and otherwise not changes except for white spaces. Something similar was achieves in Git 2.18 by using
color-moved along with
ignore-space-change, although the latter option would be applied to the whole output, not only to moves lines.
grep has got two new options:
column, which adds the column number of the first hit to the output; and
only-matching, which restricts output to only the matching part of a regular expression, instead of the whole matching line.
Git 2.19 improves
git branch list in two ways. First,
git branch --list now reads its default sort options from the
branch.sort configuration variable, similarly to
git tag --list getting its sorting default from
tag.sort. Additionally, the
-l option to
git branch, which was a shorthand to
-create-reflog, has been deprecated to prevent developers using it inadvertently as
Since version 2.6, Git provides a
git fsck command to check the integrity of objects that are being pushed to a repository. This test can be performed on the receiving end and configured using the
receive.fsck.* variables. For example, you could tell Git to reject a push if
fsck fails due to zero-padded file modes defining the
receive.fsck.zeroPaddedFilemode variable. Git 2.19 provide a counterpart to do the same for
git fetch, using the
On the implementation side, performance of
git submodule foreach has been improved by rewriting it in C. Additionally, support for command line completion has been improved by reporting the list of configuration variables used by subcommands as well as including options prefixed with
git fetch command supports a new
--negotiation-tip option to reduce the set of commits that are returned. This can improve bandwidth and performance when the local repo has a lot of refs that are not present in the remote history.
On the developer front, Git 2.19 has forbidden the use of
strcat, which is deemed too dangerous, and will now cause a compilation failure.
There are many more new features in Git 2.19 than we may cover here. If you are interested in the full detail, do not miss the official release notes.