I have recently come accross with a new solution to one of my biggest headaches in any linux system and it is to manage the nightmareof the dot files. I have previously used stow in order to mantain the symbolic links, but there is a much better solution using git bare repositories.
- Create a git bare repository with the following line
mkdir $HOME/.cfg
git init --bare $HOME/.cfg
- Create an alias for a better managing of the configuration
alias config='/usr/bin/git --git-dir=$HOME/.cfg/ --work-tree=$HOME'
It should be highlighted that you can put it in your .bashrc or the file you use for your alias, in my case $HOME/.config/aliasrc
- Disable the tacking of any single file
config config --local status.showUntrackedFiles no
- You can use it in a normal basis with config and keywords like "add, delete, status, checkout, ...". Remember to add a remote repositoryy with this lines
config remote add origin <remote-url>
config push -u origin master
For example you can create a diferent configuration in different branches for each machine that you have.
- Prevent weird circular dependencies
echo ".cfg" >> .gitignore
- Clone the remote repository
git clone --bare <remote-git-repo-url> $HOME/.cfg
- Restore the alias and configuration of tracking
alias config='/usr/bin/git --git-dir=$HOME/.cfg --work-tree=$HOME'
config config --local status.showUntrackedFiles no
- Proceed to checkout
config checkout