The open source Git distributed version control system, the cornerstone of the GitHub code-sharing site, has been upgraded with faster submodules and improvements for diffs and testing.
Version 2.9, released this week, expands options for submodules, which enable users to keep another Git repository in a subdirectory of a repository. The submodule improvements focus on speed and flexibility.
"Inthe last release, we showed you how to use the
--jobs=<N> option to fetch submodules in parallel, which can be a real time saver," said Jeff King, GitHub infrastructure engineering manager. "Now you can also use the
--jobs option when cloning or updating submodules." To always process submodules in parallel, users can set up
submodule.fetchJobs config option.
Git’s diff engine has a new heuristic for clarity in version 2.9. Diffs primarily show changes, additions, and deletions, King explained. "But because Git generates the diff only from seeing the ‘before’ and ‘after’ states of your files, sometimes the way it shows the changes can be pretty confusing." The upgrade’s heuristic tries to show exactly what the author wrote. "This new heuristic is still experimental, and may change in the future or even become the default," King said. "For now, you can enable it with the
--compaction-heuristic option on the command line, or by setting
diff.compactionHeuristic in your git config." Additionally, rename detection is now enabled by default for diffs.
Version 2.9 makes it easier to test full branches via Git’s interactive rebase capability. "At its heart, interactive rebase is really just a recipe of instructions to follow: pick this commit, then squash that one, now edit the message on this one, and so on," said King.
Rebasing is replaying a series of commits on a new base. "Among other things, this can be used to organize your work and show it was a clean, logical series of commits for reviewers," King said.
King also stressed the importance of the Git project to GitHub. "GitHub relies on Git in two ways. One, it is the client software used by the majority of our customers to create and work on the repositories that we host. And two, our server-side infrastructure uses Git at its core to interact with the repository data," he said.