This is readme file of Dogit, dotfiles management tool based on git.
The trick is to turn your home directory into git repository and track configuration files directly in the original place. This way you don't need to setup symlinks for tracked configuration files or copy them into the right place manually. The main advantage of such approach is that you are still able to use all git tools on the dotfiles, such as blame, checkout, log ... Since homedir usually contains many other files besides configuration worth tracking, git needs to ignore all files in the working tree with the exception of config files we actually want to track.
This idea itself is not new, see eg.:
- managing dotfiles with git (2008)
- profile management with git and github (2009)
- managing your configuration files with git and stgit (2009)
- config
- and many others ...
To get a better idea what's going on here, let's see how it may work if done in bash by hand:
$ mkdir ~/.config.git
$ alias dotfile='git --git-dir=$HOME/.config.git/ --work-tree=$HOME'
$ dotfile init
$ echo '*' > .gitignore
$ dotfile add -f ~/.gitignore
$ dotfile commit -m 'initial commit (just gitignore)'
This script provides the same functionality as init command:
$ dogit init ~/.config.git
Then to include config file:
$ dogit add ~/.gitconfig
$ dogit commit -m 'initial git configuration'
Note: you can see what the wrapper does using '--debug' option.