Highlights from Git 2.31
github.blog
github.blog
It's a background server that you launch with `git maintenance start`.
> This cross-platform feature allows Git to keep your repository healthy while not blocking any of your interactions. In particular, this will improve your git fetch times by pre-fetching the latest objects from your remotes once an hour.
Instead, the remote refs are stored in
refs/prefetch/<remote>/. Also, tags are not updated.
This is done to avoid disrupting the remote-tracking branches. The end users expect these refs to stay unmoved unless they initiate a fetch. With prefetch
task, however, the objects necessary to complete a later real fetch would already be obtained, so the real fetch would go faster. In the ideal case, it
will just become an update to a bunch of remote-tracking branches without any object transfer.
So looks like they though of it & looks like there's no reason not to do this?The commits referenced in the blog post look to be from the Scalar team lead as well. Looks like some of their work is getting upstreamed which is exciting. [2]
Although, I wonder what this means for the Scalar project itself.
[1] https://devblogs.microsoft.com/devops/introducing-scalar/
[2] e.g., https://github.com/git/git/compare/26bb5437f6defed72996b6a2b...
Putting background maintenance into Git was actually part of our effort to get Scalar on Linux.
You might be interested in our "Philosophy of Scalar" [1] document, which includes this paragraph:
> Scalar intends to do very little more than the standard Git client. We actively implement new features into Git instead of Scalar, then update Scalar only to configure those new settings. In particular, we are porting features like background maintenance to Git to make Scalar simpler and make Git more powerful.
[1] https://github.com/microsoft/scalar/blob/main/docs/philosoph...
Implemented via crontab on linux, launchctl on MacOS, and schtasks on Windows.
https://git-scm.com/docs/git-maintenance#_background_mainten...
> You could manage these data-structures yourself, but you might not want to invest the time figuring out when and how to do that.
On the other hand, not everyone will use `git maintenance`, so by the same token you could argue it's unnecessary bloat.
This seems like a relatively small feature (about 2K lines of code by my count, a great deal of which is tests and docs) that results in a big quality-of-life improvement for anyone who works on large repositories.
Since it's not something that turns itself on, eating your RAM behind your back, or slowing the computer silently, I'd say let the feature creep in as long as the maintainers are happy to maintain it.
0 1-23 * * * "/<path>/git" --exec-path="/<path>" for-each-repo --config=maintenance.repo maintenance run --schedule=hourly
0 0 * * 1-6 "/<path>/git" --exec-path="/<path>" for-each-repo --config=maintenance.repo maintenance run --schedule=daily
0 0 * * 0 "/<path>/git" --exec-path="/<path>" for-each-repo --config=maintenance.repo maintenance run --schedule=weekly
`git for-each-repo` was a useful addition in 2.30, by the way.Time for a plug for Folder Git[2], which runs a Git command in a bunch of folders, as in
fgit maintenance run -- ~/dev/*
[1] https://git-scm.com/docs/git-maintenanceI feel like Git let its brand get used by others and now that's that. Kind of illustrates why companies defend their trademarks so vigorously.
TL;DR: GitHub applied for a US trademark 5 years before the Git project did, so the initial application from the Git project was denied as confusingly similar to GitHub. Rather than litigate who got to use what, the parties came to an agreement to continue using the marks in parallel as they had been doing, which allowed the Git project to be granted a US trademark. The Git project also grandfathered in others who had been operating in good faith like GitLab.
[0] https://public-inbox.org/git/20170202022655.2jwvudhvo4hmueaw...
"The open source Git project just released Git 2.31 with features and bug fixes from 85 contributors, 23 of them new"
With a link to the lore.kernel.org mailing list archive
Right now I just use "--depth 1" often to prevent the download of the entire history. But it is not ideal.
I'm happy to answer questions and take any feedback.
[1]: https://github.com/kevin-hanselman/dud
[2]: https://rclone.org/
The Tim Harper version on source forge is indeed 2.27.0 and was last built for Mavericks. A general poke about activity suggests that he's much less active in various online communities now than he has been in the past - he might have gotten bored.
I don't see an update for Xcode command line tools yet - it was only released today. That said, I'm not overly optimistic as the version bundled in Xcode appears to be 2.24.3 (which is from April of 2020 https://github.com/git/git/releases/tag/v2.24.3 ).
Macports git is 2.30.2 (as of this typing... which is only 7 days old).
If you're on a Mac, use one of the package managers... or see if the git organization needs a new build maintainer for OSX.