The open-source Git project has released Git version 2.37 which adds several new features, improvements, and bug fixes. The key highlights of the latest version include a new mechanism for pruning unreachable objects, a built-in file system monitor, and a widely available sparse index. For more details about this release, continue reading further.

 

Git 2.37 adds a new mechanism for pruning unreachable objects

 

What's new and improved in Git 2.37

A new mechanism for pruning unreachable objects

Git 2.37 introduces a new concept, cruft packs, which allow unreachable objects to be stored together in a single packfile by writing the ages of individual objects in an auxiliary table stored in a *.mtimes file alongside the pack.

 

While cruft packs don’t eliminate the data race we described earlier, in practice they can help make it much less likely by allowing repositories to prune with a much longer grace period, without worrying about the potential to create many loose objects. To try it out yourself, you can run:

 

$ git gc --cruft --prune=1.day.ago

 

 

A builtin filesystem monitor for Windows and macOS

When you run git status, for example, Git has to crawl your entire working directory (in the worst case) in order to figure out which files have been modified. Git has its own cached understanding of the filesystem to avoid this whole-directory traversal in many cases. But it can be expensive for Git to update its cached understanding of the filesystem with the actual state of the disk while you work.

 

In the past, Git has made it possible to integrate with tools like Watchman via a hook, making it possible to replace Git’s expensive refreshing process with a long-running daemon that tracks the filesystem state more directly.

 

But setting up this hook and installing a third-party tool can be cumbersome. In Git 2.37, this functionality is built into Git itself on Windows and macOS, removing the need to install an external tool and configure the hook.

 

You can enable this for your repository by enabling the core.fsmonitor config setting:

 

$ git config core.fsmonitor true

 

After setting up the config, the initial git status will take the normal amount of time, but subsequent commands will take advantage of the monitored data and run significantly faster.

 

 

The sparse index is ready for wide use

Often when working in an extremely large repository, you don’t need the entire contents of your repository present locally in order to contribute. For example, if your company uses a single monorepo, you may only be interested in the parts of that repository that correspond to the handful of products you work on.

 

The sparse index makes it possible for the index (a key data structure that tracks the content of your next commit, which files have been modified, and more) to only keep track of the parts of your repository that you’re interested in.

 

With Git 2.37.0, all of those integrations are now included in the core Git project and available to all users.

 

 

How to download the latest version of Git

The latest version of the Git client can be downloaded from the official site. To download Git version 2.37 for Windows, click here. To download Git version 2.37 for Linux/Unix, click here. To download Git version 2.37 for Mac OS, click here.

 

Have a question? Or, a comment? Let's Discuss it below...

Thank you for visiting our website!

We value your engagement and would love to hear your thoughts. Don't forget to leave a comment below to share your feedback, opinions, or questions.

We believe in fostering an interactive and inclusive community, and your comments play a crucial role in creating that environment.