A followup to "Extremely Linear Git History"

By Gustav Westling

Hey, this is a follow-up to Extremely Linear Git History.

The origin idea of the previous post was obviously a bit of a joke, taking inspiration from bitcoin mining, and version control systems of the past (aaah, a simpler time).

The post exploded (over 40 000 page views tracked in Google Analytics, so probably way more than that in reality, given the audience), it was #1 on Hacker News for many hours, was circulating on Twitter, Reddit, etc etc. Obvioiusly the HN discussion derailed (most of it is off-topic)

I thought I knew what this post was going to be about. I was, happily, wrong.

I thought it was going to be a post about rebasing in git, since its called "Extremely Linear Git History" and it sort of is, but in a way more fun way.
@adamgordonbell
A neat trick with this tool is to generate a commit message that corresponds to a given issue number. It could almost be useful.

https://news.ycombinator.com/item?id=33706665
> This is very silly. https://news.ycombinator.com/item?id=33704521
> This is absolutely genius. Would be nice to upstream it and make it fast. I would start using it. https://news.ycombinator.com/item?id=33705410
> Proof of work git hashes. This is nuts and I love it. https://news.ycombinator.com/item?id=33713804
> “shit show” 😂 https://www.reddit.com/r/programminghorror/comments/z3fwdx/comment/ixlj8br/?utm_source=reddit&utm_medium=web2x&context=3

Even Elon reached out an called me a "hardcore hacker".


After the post blew up. I started working on actually improving the project, from the shitty 50-lines of bash script that I previously had.

It's still in bash, and it's still glorious.

New features include:

  • Faster GPU-powered SHA-1 prefix generation, powered by lucky_commit
  • A "shit" ("short git") CLI wrapper for git, that works with the incremental prefixes ("shit show 14" -> "shit show 00000140")
  • Easy setup post-commit hook
  • Customizeable formats
  • Customizeable epoch - make the latest commit your 00000000 commit, so that you can get started without rewriting the full project history
  • Built in branch filtering, for example, to only run on your main branch ("git linearize --install-hook --if-branch main")
  • Cleaned up the output,
  • I even added tests!

After doing this, and building git-linearize on top of git-linearize, I kind of started to like it, more than in a "haha, omg this is such a hack" kind of way. I actually like this process.

Just look at this! Just by looking at the output I knew that I hadn't pushed in 3 commits. Genious.

$ git push
Enumerating objects: 16, done.
Counting objects: 100% (16/16), done.
Delta compression using up to 10 threads
Compressing objects: 100% (10/10), done.
Writing objects: 100% (11/11), 2.89 KiB | 2.89 MiB/s, done.
Total 11 (delta 6), reused 0 (delta 0), pack-reused 0
remote: Resolving deltas: 100% (6/6), completed with 3 local objects.
To github.com:zegl/extremely-linear.git
   0000040..0000043      main -> main
git fetch origin pull/${ PR_NUMBER}/head && \
    git merge --ff-only FETCH_HEAD && \
    git linearize