Git Spelunking to Avoid Linkrot

# This is an RSS-only post. It's a secret! Read more about RSS Club.

I have been very inconsistent with using github's permalinks in my blog posts.

While emailing an old post to my new friend Justin I found that the links were to the most current version of my hammerspoon config… which has long since changed. Doh!

I'm glad that I usually embed pertinent code into the blog post… that helps a lot to keep the content useful long into the future.

But anyway!

I started to try to find a regex that would represent GitHub links to my own repos that weren't permalinks. I got as far as rg --pcre2 "github.com/evantravers/\w+/(?!(blob|commit|compare))" but I realized I was quickly in the land of negative lookahead, and that's too much regex for me. I wound up just loading the results of github.com/evantravers into my nvim quickfix list via Telescope and working through it manually.

Thanks to stack overflow I found a git snippet for checking out a git repo at a certain time. Using this I could time-travel in my dotfiles or hammerspoon-config repo back to the hour that I posted the blog post and grab the git commit SHA. By running %s,/master/,<new sha>,g in vim I replaced all the tree references with the correct point in the history, and hopefully the timeline has been saved.

You're welcome, Doc Brown.


🔖
Changelog
  • 2024-02-20 09:57:16 -0600
    Fix typo

  • 2024-02-20 09:53:48 -0600
    Quick post