gsthnz's blog

How I manage my dotfiles Sep 9, 2020

Dotfiles are a very personal thing, some people stick with the defaults of every program, others have a config file for every single program they use. 1 Whether or not you configure all your tools or not, losing your environment is always a pain, many hours lost invested configuring your editor to do that little stupid thing you wanted it to do gone to waste, and now, another many hours figuring out what you had to configure again. With this, one can argue that keeping your dotfiles managed in some sort of version control is a very sane and healthy thing to do.

There are many ways to manage dotfiles, there’s a famous github page showing some dotfile managers and also some dotfiles repositories for inspiration. Personally I find the added complexity of some of the dotfile managers to be a huge turnoff, mainly because of the “I just installed by base system and now I have to install a list of dependencies to have my config files in place” reason.

The way I first started doing this was by symlinking the config files from a version-controlled folder, that way, any changes on these files will be reflected on the dotfiles repository. This method is simple enough that you can do it with a simple shell script, it will work beautifully, and your only real dependency is a system that can do symbolic links. This is the way I recommend people that don’t manage dotfiles to start, it will work for most people. There’s even a tool called Stow available in most distros that manages files this way.

Later on I started to see that keeping track of the links in your system could become a bit troublesome. Mainly if you add and remove files all the time. As I use a lot of different tools on my system, and I’m always experimenting with new ones, I happen to have a lot of “traffic” in my dotfiles. This reason alone made me search for a alternative, and that was git.

Git can do a lot of awesome things, one of these things is to have a worktree outside of the repository. This means that I can have a repository at ~/.local/share/repository but my worktree could be in ~/ and I can git add my files in my home directory and manage them like a normal git repository. There are a lot of tutorials on the web to set this up, and there’s a tool called Yadm which works very nicely and I used for quite some time.

My dotfiles are now a simple git repository containing my tracked home worktree, and I use a simple script made by myself called dtfl to clone and manage them. It will work in any system that has git installed, it’s easy to maintain and it gets out of my way. 2


  1. Totally not me :p ↩︎

  2. Gets out of my way so that I can waste more time ricing my setup. ↩︎


Have questions or comments? Use my public inbox by sending a plain text-email to ~gsthnz/public-inbox@lists.sr.ht