Dotfiles and managing them through YADM

The Back Story

I'd known about Dotfiles and their importance for the longest time, yet took no effort to manage them through a repository of any kind. What this meant was that my workflow for moving to a new machine at work (when I moved from a PC with a CentOS VM) to a Macbook, and then from that Macbook to a newer version of it was to copy the entire home directory, including files I didn't need anymore. There was always the constant worry that I'd lose my aliases, prompt alterations etc and would have to set them up again from scratch if the hard disk crashed overnight.

What put me off using a repository for managing these files was that the learning curve seemed really high, having to write scripts to create links to them, or start by using publicly available dotfiles repositories. The issue with the last approach is that I'd end up with things I don't need, having no support as such for anything that goes wrong etc. Looking back, I missed out on opportunities to learn advanced shell scripting by doing something like that.

In comes YADM

After deciding on moving to free software, and subscribing to some podcasts, I came across YADM, which stands for Yet Another Dotfile Manager.

The premise of YADM is simple. The home directory is treated like a git repository and we can execute git commands to manage the files. Instead of git, one has to use yadm to do so, and yadm takes care of the rest.

The Process

Installing YADM is simple. For Ubuntu based distros, the package is available on the standard apt repositories, though it's outdated like I learned yesterday trying to play around with the bootstrap command which expects an executable at a documented path. The old package expects the file at a different location to what's in the latest documentation.

After installing YADM, keep adding the files like .bashrc, .bash_profile, .gitconfig, .gitignore etc using yadm add, add a remote using yadm remote add <url_of_remote_repository>, yadm commit etc.

The tool also supports templating,, secrets management etc though I haven't had a need to use them yet.

First Impressions

This tool takes away the procrastination and learning curve factor from those who want to start maintaining their dotfiles. Having the safety net of a git system means that I can experiment with different configurations with the option of reverting to the original without much effort.

Gotchas

Like I mentioned before, the package in the apt repository is outdated. I would have been better off installing it from source instead.