I'm wondering if there is a new tool out there that I'm missing out on.

you are viewing a single comment's thread
view the rest of the comments
[–] 2 points 3 years ago*

I use git (without remote repo, but could be easily added). Actually this simple bare git repo technique is something I enjoy doing in lots of places where config files lie.

Basically, it's only: alias config="/usr/bin/git --git-dir=\${HOME}/.myconf/ --work-tree=\${HOME}"

Of course, a first time setup is required:

git init --bare $HOME/.myconf
config config status.showUntrackedFiles no

I got this setup from a comment on HackerNews long ago. OP comment was rather insightful: "No extra tooling, no symlinks, files are tracked on a version control system, you can use different branches for different computers, you can replicate you configuration easily on new installation."

But I never used any branches, prefer to keep it extremely KISS. I even avoid commiting, just staging area that I keep updating with each OS upgrade. Only this bit of extension I use... since I don't push to any remotes (prefer keeping dotfiles private), I needed a way to copy all of the tracked files (e.g. to have my settings on a work laptop, of course I then go ahead and clean any boilerplate before moving such an 'exported' folder)...

config_export() {
    echo "Copying only staged files, it is recommended to run beforehand: $ config add -u ~"
    mkdir -p ~/.config_export/
    CONFIG_FILES=$(config status | /usr/bin/grep 'new file:' | cut -d':' -f2 | sed -E 's/^ +//')
    printf "%s\n" "${CONFIG_FILES[@]}" | xargs -I {} cp --parent '{}' ~/.config_export/
    ls -halt ~/.config_export/
}
  • source