Ramblings of an aging IT geek
← Ramblings of an aging IT geek
tooling

i finally bare-repo'd my dotfiles and i'm annoyed it took this long

After years of symlink farms and copy-paste, I moved my dotfiles to a bare git repo tracking my home directory, and it just works.

A keyboard and terminal

My dotfiles have been a mess for years. A folder of configs, a install.sh that symlinked things into place, and a maintenance burden I kept putting off because the script always broke in some new way on each new machine.

This week I switched to the bare repo trick and I'm faintly cross at myself for not doing it ages ago. The idea: a git repo whose work tree is your home directory, but whose git directory lives somewhere out of the way, so it doesn't try to track every single file in $HOME.

git init --bare $HOME/.dotfiles
alias dot='git --git-dir=$HOME/.dotfiles/ --work-tree=$HOME'
dot config --local status.showUntrackedFiles no

That showUntrackedFiles no is the trick that makes it usable. Without it, dot status lists your entire home directory as untracked and it's unreadable. With it, you only ever see the files you've deliberately added.

After that it's just git. dot add .vimrc, dot commit, dot push. On a new machine you clone the bare repo and check out, and your config is in place. No symlinks, no install script, no bespoke tooling to maintain. The thing I'd been avoiding building turned out to be something I didn't need to build at all. Git already did it.