The open source Git project has just released Git 2.8.0, featuring a variety of features, bugfixes, and other improvements from over 70 contributors. Here are some of the most useful new features:
Using “git submodules”, one Git repository can include other Git repositories as subdirectories1. This can be a useful way to include libraries or other external dependencies into your main project. The top-level repository specifies which submodules it wants to include, and which version of each submodule.
When you fetch into the top-level repository, you typically want to fetch into the submodule repositories as well:
git fetch --recurse-submodules
If you have a lot of submodules, all of these fetches can be time-consuming;
git fetch is essentially run in each submodule in turn. But now you can speed things up by fetching from multiple submodules in parallel. For example,
git fetch --recurse-submodules --jobs=4
runs four submodule fetches at the same time. This should be a real time saver! [source]
If you use the same name and email address to commit to all of your Git projects, then you can configure those values once and for all in your global
git config --global user.name 'Me Myself' git config --global user.email email@example.com
But if, say, you want Git to use one email address for your open source projects and a different one for your work projects, you’ve undoubtedly made the mistake of committing to a new Git repository without having first set your email address in that repository. In this situation, Git emits a warning, but it creates the commit anyway, using an email address that it guesses from the local system hostname. If you’re trying to do something as complicated as different addresses for different projects, this is almost certainly not what you want.
Now you can tell Git not to guess, but rather to insist that you set
user.email explicitly before it will let you commit:
git config --global user.useconfigonly true
There has recently been a big push to make Git feel as comfortable on Windows as it does on Linux and OS X. For example, it is relatively expensive to start processes on Windows, so many Git commands that were originally written as scripts have been rewritten in C to make them snappier.
In this release, a bunch of Windows-specific changes have been brought back from the Git for Windows project into the main Git project. This continuing effort will make it easier to keep the functionality of Git in sync across platforms as new features are added. [source, source, source, source]
Along the same lines, several Git commands that use text files as input have been made to accept both LF and CRLF line endings. That should reduce friction on Windows, where many tools may produce files with CRLF line endings. [source]
Git 2.8.0 includes the security fixes for CVE-2016-2324 that were first made available in Git 2.7.4. This vulnerability is not known to have any exploits in the wild, but could result in executing arbitrary code when cloning a malicious repository. We recommend that everybody upgrade to a version of Git with these fixes, namely 2.4.11+, 2.5.5+, 2.6.6+, 2.7.4+, or of course 2.8.0+.
In addition to these fixes, this release contains a number of cleanups designed to make it easier to avoid similar bugs in the future.
- Git’s clean and smudge filters can now be turned off by setting them to the empty string. This feature is notable mainly because it is used by the new
git lfs clonecommand, which can dramatically reduce the time to clone a repository that uses Git LFS. [source]
Git configuration values are read from several different places, including system-level, user-level, and repository-specific files. This can make it hard to figure out where a setting has to be changed. Now you can use
git config --show-originto show where a particular setting came from:
$ git config --show-origin user.name file:/home/me/.gitconfig Me Myself
You can use the new
git ls-files --eol FILENAMEto help diagnose end-of-line problems in a file:
$ git ls-files --eol README.md screenshot.png i/lf w/lf attr/ README.md i/-text w/-text attr/ screenshot.png
The output shows (i) the EOL style auto-detected from the file’s contents in the index, (w) the EOL style detected from file’s contents in the working copy, and (attr) the style that is configured for the file via gitattributes. [source]
git ls-remotecan now also tell you a remote repository’s default branch:
$ git ls-remote --symref origin HEAD ref: refs/heads/master HEAD db6696f653b917509dac1ac13b922e12773a84ff HEAD
- Support for cloning via the
rsyncprotocol, which was superseded long ago by better alternatives, has been dropped. [source]
That’s just a sampling of the changes in Git 2.8.0. Check out the the full release notes for the complete list.
 Git submodules are analogous to Subversion’s