BT

Facilitating the spread of knowledge and innovation in professional software development

Contribute

Topics

Choose your language

InfoQ Homepage News Git 2.31 Release: Maintenance Moved to Background

Git 2.31 Release: Maintenance Moved to Background

Bookmarks

By moving the Git maintenance in the background and adding reverse indexes on disk, Git 2.31, intends to make this omnipresent tool more user friendlier and faster when executing common operations like fetch and push.

Even if most of the time the automatic cleaning mechanisms of various tools are making our lives easier, there are those critical moments when a Git garbage collection (gc) stops our normal flow leaving us staring at a terminal screen. One of these situations is signaled by the following message in case of Git:

Auto packing the repository for optimum performance. You may also run "git gc" manually. See "git help gc" for more information.

After this happens, you are stuck waiting regardless of what you were doing. Needless to say, these Git maintenance operations are essential and when starting with version 2.31 there is another option: git background maintenance. This new feature allows you to keep your repository healthy while not blocking any of your interactions.

To make your interactions more efficient, Git comes with preconfigured actions that will increase its efficiency. It will prefetch the latest objects from the remote repositories and ensure that the commit-graph file is updated once an hour. Also, it will pack any loose objects and incrementally repack packed objects daily. For a deeper understanding of this feature, read its documentation.

Git stores all data as "objects": commits, trees, blobs etc.,  and stores the content of individual files. For improved storing, many objects are put into packfiles, which are essentially a concatenated stream of objects. In order to still be able to access each individual object efficiently, an index for each packfile is generated. In this way it was possible to quickly navigate from an object’s ID into its byte offset within the packfile.

The reverse binding, a mapping between locations in a packfile and the object each location is part of, called reverse index, was computed up to version 2.31, on the fly. Starting with this version, these mappings can be found in .rev files on disk, containing an array sorted by position containing object-position pairs.

By using already computed reverse indices, Git can send object bytes directly from disk much faster, helping during fetch and/or push operations. 

Currently the .rev files are not generated by default; one can enable them by running:

git config pack.writeReverseIndex true

and then repacking your repository (git repack -Ad).

We need your feedback

How might we improve InfoQ for you

Thank you for being an InfoQ reader.

Each year, we seek feedback from our readers to help us improve InfoQ. Would you mind spending 2 minutes to share your feedback in our short survey? Your feedback will directly help us continually evolve how we support you.

Take the Survey

Rate this Article

Adoption
Style

Hello stranger!

You need to Register an InfoQ account or or login to post comments. But there's so much more behind being registered.

Get the most out of the InfoQ experience.

Allowed html: a,b,br,blockquote,i,li,pre,u,ul,p

Community comments

Allowed html: a,b,br,blockquote,i,li,pre,u,ul,p

Allowed html: a,b,br,blockquote,i,li,pre,u,ul,p

BT

Is your profile up-to-date? Please take a moment to review and update.

Note: If updating/changing your email, a validation request will be sent

Company name:
Company role:
Company size:
Country/Zone:
State/Province/Region:
You will be sent an email to validate the new email address. This pop-up will close itself in a few moments.