Putting your .dot files in a repository

After 15 years of manually copying my dotfiles between my machines I finally decided it was time to put them in a repository.

GitHub has a good page explaining why you’d want to do this along with many links to different scripts. I settled on dotfiles because it seemed the simplest and at this point, I didn’t want too many moving parts.

Let’s imagine you have a single .vimrc file that you want to manage.

# Install dotfiles
pip install dotfiles
# Copy ~/.vimrc to ~/Dotfiles/vimrc and symlink ~/.vimrc to ~/Dotfiles/vimrc
dotfiles --add ~/.vimrc

At this point, you now want to manage your Dotfiles directory somehow. I’ve become partial to Bitbucket lately given that they let you have unlimited private repositories. Congratulations! You’re almost done.

On a new machine, clone your repostiory in to ~/Dotfiles and then run

dotfiles --sync

And that’s it! It makes me wonder why I didn’t do this years ago.