Git 2.10 has been just released. In this blog post, we are going to cover the major enhancements and features. If you wish to read the official release notes, they can be found here. The aim of this blog post is to collect the most notable stuff and offer a "TLDR" version for those interested. Without further due, let's jump right into the most prominent features.
Shallow clones for submodules
One of the notable changes in Git 2.10 is that you can specify a recommendation to shallowly clone submodules. The configuration happens in the
.gitmodules file. The configuration for shallow cloning of submodules is done by appending a new setting as follows:
[submodule "example"] path = example url = email@example.com:deveo/projects/testing/repositories/git/example shallow = true
There is another enhancement for submodules besides allowing shallow cloning. Updating submodules retry fetching changes in case of flaky servers or network conditions.
Git comes baked in with an auto-completion script you can enable if you use the Bash shell. Enabling auto-completion requires you to do three things if your operating system or package manager does not ship the completion scripts by default. First, download the Git source code. Second, copy the
contrib/completion/git-completion.bash file to your Home directory. And third, add the following line to your
Git auto-completion allows you to find Git commands and their options with tab-completion. If you are looking for a certain switch for a specific command, simply tap the tab key after entering the command and the auto-completion lists the possible options.
In Git 2.10 the auto-completion script added support for options in
git status command. In addition, as a smaller enhancement, it also lists certain options for
git branch command.
Git fully supports colored terminal output, which greatly aids in visually parsing command output quickly and easily. In Git 2.10, the output coloring scheme can now handle
strike (through) text in addition to existing
reverse, which swaps foreground and background colors. The color can be set to any of the following values:
white. As an "imaginary" example below, we changed the meta information of diffs to strikethrough and bold text with magenta background and cyan text with the following command:
git config --global color.diff.meta "cyan magenta strike bold"
See the output of
git diff command after the change below:
You can read more about coloring and configuration from the Git book.
git archive command creates an archive of the specified format containing the tree structure for the named tree and writes it out to the standard output. The command is useful for either creating source distributions or downloading just a certain version of a given repository. In Git 2.10, the
git archive command can handle files that are larger than 8 gigabytes, even though you should probably find a better way to manage large files in Git repositories.
git status command now suggests aborting a merge with
merge --abort during a conflicted merge. This follows the same suggestion offered when rebasing causes a conflict.
In Git 2.10, the
git push and
git clone commands are supposed to give better progress meters to the end user who is waiting on the terminal. I recorded a video that is in GIF format below. The numbers in percentage and other counter seem to have a bit smoother updates.
Last, but not least, a new configuration variable
core.sshCommand has been added to specify what value for
GIT_SSH_COMMAND to use per repository. This is a useful setting if you are working with multiple servers with varying configurations, such as proxies or tunneling.
The above is just a tiny glance at the full list of changes that were part of Git 2.10 release. You can read the official release notes here. All in all, Git 2.10 packs a lot of new stuff to help developers work even more efficiently than before. What's your favorite enhancement in Git 2.10? Did we miss anything crucial? Share a comment below, or even better, share this article around if you enjoyed reading it.