Sometimes the need arise to organize and versionize your dotFiles. Meaning the configuration that hangs around in your home folder a.k.a. ~ or in .config. Today I read a solution with wich I totaly disagree.
You can read about it at Martinovics blog, but basicly he is versionizing the whole of home with git and then ignore everything but the dotFiles.
My aproach to dotFiles is somewhat similar that I also use git. I have a Folder called dotFiles in my Homefolder which is a git repositorie. Lot of people do this an then they create symlinks
so the config is actually used. I use this aproeach but with a twist:
stow. Stow is a symlink farm manager. This description doesnt help anybody who does not now how it works so here is an example:
So we are in
~/dotFiles/ and we want to, lets say, create a config for
xinit - however it asumes that its config is located at
~/.config. What we do is create a folder called
~/dotFiles/ and then create
.xinit inside the
xinit folder. Ok that doesn’t do us any good you say. But thats where
stow comes into play: just type
stow xinit in your dotFile directory.
And here is what it does - it takes the content of the folder you pointet it at (
xinit) and symlinks it to the parent folder (
~). So erverything in
~/dotFiles/xinit is symlinked to
~; this is when your working dir is
~/dotFiles. You can delete the Symlink with
stow -D xinit. Totally easy and you don’t have to remember the
ln syntax - which you shoud ;).
Lets say you have
something that wants its config in
~/.config well than you have to create the folder
~/dotFiles/something/.config/ and write your config for
something inside the
.config folder there. Versionize it and the
stow something from within
Oh and did you ever wonder why people do this:
mkdir something cd something mkdir .config
when they could just do this:
mkdir -p something/.config/? Me too…