canteen's blog

Git bundles are pretty cool

I found out about git bundle today!

Some background

Sometimes I make small one-off scripts or binaries for work in an esoteric (lisp, rust, etc) programming language that nobody else uses. This is mostly a response to me being bored but I like to think it keeps me active intellectually and so might stave off my inevitable decline once I get even older. When I tell my colleagues about these, about three quarters end up getting sleepy in a polite way. The remainder might want to see my work. Then the problem becomes shipping it to them.

I might say “I will put it on github”, but generally this code is for an extremely specific use-case, not that pretty and occasionally it will have an internal secret in there. That last one hasn’t happened to me in a while, but it’s also just not necessary to publish a repository if it’s not meant for public consumption.

Why not just gzip the entire repository?

Sometimes I will send interested people a compressed folder and call it a day, but that is sort of irritating when one of us changes something (kind of like code golf, it’s nice) and would like to show the other. The big brain move there is to have patch files, which works okay but doesn’t preserve a common history tree. That makes it hard to talk about commit history.

In truth, there’s not that many situations where this becomes a problem. But there are some! And that was enough to try and find something else.

git bundle, finally

Now for the potatoes of this post: git bundle. It allows you to bundle up your entire repository or part of it’s history tree into a single file, which you can then email to folks and have them pull from. Pretty nice.

#computer