Some people keep their dotfiles in a repo and distribute them across all machines they work on. However, quite often a specific machine needs some specific setup in terms of aliases, environment variables, etc. These changes are machine-specific and should not pollute the general dotfiles (repo). I achieve this by what a call “local” dotfiles. Here is my setup:
I have my dotfiles in the repo
Depending on the environment, I link to the dotfiles I need:
.bashrc, just using the excellent zsh shell) contains the following:
This will obviosly source the different dotfiles in my home dir. The little * allows to further load the “local” dotfiles.
As an example, the stock
~/.envars may look like this:
~/.envars.local appends some more info:
I am using a similar concept in my
At the end of it, I have the line
When setting up a new environment, I’ll run:
The local files also allow to try out new settings which will may eventually be merged into the repo containing the stock dotfiles. You should not forget to merge them eventually, though!