Hands down, this is the best way I have found so far, for managing dotfiles without needing to symlink to a local repo somewhere.

Instead we use a --bare git repository and set up a simple alias.


git init --bare $HOME/.dotfiles
alias dotfiles='/usr/bin/git --git-dir=$HOME/.dotfiles/ --work-tree=$HOME'
echo "alias dotfiles='/usr/bin/git --git-dir=$HOME/.dotfiles/ --work-tree=$HOME'" >> $HOME/.zshrc
  • note: I am a zshrc user, if your using bash, then echo the alias to .bashrc


Create a github repo, named ‘dotfiles’

Set origin for github repo

dotfiles remote add origin git@github.com:<username>/dotfiles.git


dotfiles status
dotfiles add .config/i3/config
dotfiles commit -m 'Adding i3 Config'
dotfiles push


Should you then want to set up your dotfiles on another machine:

git clone --separate-git-dir=$HOME/.dotfiles https://github.com/<username>/dotfiles.git dotfiles-tmp
rsync --recursive --verbose --exclude '.git' dotfiles-tmp/ $HOME/
rm --recursive dotfiles-tmp