3 ms·
I have tried a custom linking script, Ansible, and stow. The best I have found is to just use a bare git repo based off of: https://www.atlassian.com/git/tutori
by stonewareslord 6y ago
I have tried a custom linking script, Ansible, and stow. The best I have found is to just use a bare git repo based off of: https://www.atlassian.com/git/tutorials/dotfiles https://www.atlassian.com/git/tutorials/dotfiles
The idea is to make an alias that runs git so that it treats your home directory as a git repository and you can directly commit them.
I would recommend bypassing that article's `config config --local status.showUntrackedFiles no` setting and setting a `~/.gitignore`. This way, git will never tinker with your home directory if you accidentally run the wrong command.
So the complete list of setup commands is:
# Only needs to be done the first time
cat >~/.gitignore<<'EOF'
*
!/.bashrc
!/.zshrc
EOF
# On subsequent runs
git clone --bare ssh://git/cfg.git "${HOME}/.cfg"
function config() {
git --git-dir="${HOME}/.cfg/" --work-tree="${HOME}" "${@}"
}
config checkout -- ~/.gitignore
config reset ~
config checkout -- ~
config submodule update --init --recursive --remote
One caveat is adding files in subdirectories (`~/. config/...`), but just requires changes in your gitignore
- ulzeraj 6y agoThanks! Using Ansible sounds like a great idea, specially when it allows me to also match installed packages! Would be great if I could combine with a local secrets engine. Like Hashicorp Vault but local.