Managing Dotfiles

A dotfiles repo enables simple configuring of new installations, configuration syncing between multiple machines and configuration backup with a few git commands. Dotfiles stored in source control can be shared and iterated. There’s a couple of methods for doing this.

Make your home folder a git repo

Jeff Cole provides a method to initialize a git repo in the home directory. It adds all files to .gitignore and requires dotfiles be added manually:

cd ~
git init
echo "*" > .gitignore
git add -f .bashrc

The home directory as a repo has some downsides. It preserves directory structure in the dotfile repo, making it harder to share with others. It requires the same configuration files across all hosts, making a universal configuration more difficult. Files are manually added to the repo, making it easy to lose dotfiles that haven’t been added.

However, for new Linux users there are advantages to a personalized solution. Deploying only requires cloning. It’s very quick to start and it helps learn the structure of config files. Forking a bootstrap repo requires significant customization to meet an individuals needs. That customization will be easier to do after some time spent learning your needs.

Bootstrap Scripts for Dotfiles

My dotfiles repo uses this method for an out of tree directory structure with a bootstrapping shell script to symlink the files into their correct destinations. When I bring up a new system I just have to run

git clone
cd dotfiles
git submodule update --init

My personal repo works for now, but I’d recommend forking one of the github dotfiles repos. They are robust, mature configuration and environment bootstrap repos. They’ll be less hardware dependent. I’m looking at the holman repo as it also handles provisioning to configure development environments.

Leave a Reply

Your email address will not be published. Required fields are marked *