Managing dotfiles


"Dotfiles" are a way to store configuration of various packages and programs on your system. They are named so because of the '.' that precedes their names to keep them hidden.

These dot files make up the system of a user and in case the system crashes into an unrecoverable state, the user might lose all their configurations for all of their programs. This is an inconvenience and can be easily avoided by managing your dotfiles properly. Many users online suggest using tools like GNU stow to manage and store the dotfiles but I personally prefer using the $HOME directory as a git repo. This is easier and doesn't require a special tool just to manage the dotfiles.

One issue with this method is the vast amount of extra files that exist in the $HOME directory. We are not doing any linking or copying, all the files will stay exactly where you want them to be. It can be solved by using a gitignore file which ignores everything. After that you can individually git add all the required files and once you add them manually, they will be tracked forever despite of the gitignore file.


(Note: You can also add entire directories like ~/.config but make sure you don't include any of your private key files or config files with plaintext passwords by mistake. One such example is irssi config which may contain a plaintext password.)

Congratulations! You managed to backup your dotfiles to a git repository. Now any time you update a dotfile, make sure you push the changes to the repo as well.

If you need to restore your dotfiles to a fresh system follow the instructions below:

(We are doing this so that any current dotfiles might be replaced) - Done!

It is not very ideal in terms of restoration, but it works and that's all that matters. No symlinking or hacky stuff. Just a repo to love and maintain. <3