I got this guide and idea from https://www.atlassian.com/git/tutorials/dotfiles.
- Prior to the installation make sure you have committed the alias to your
.bashrcor.zshrc:
alias config='/usr/bin/git --git-dir=$HOME/.cfg.git/ --work-tree=$HOME'- And that your source repository ignores the folder where you'll clone it, so that you don't create weird recursion problems:
echo ".cfg" >> .gitignore- Now clone your dotfiles into a bare repository in a "dot" folder of your $HOME:
git clone --bare git@github.com:armytrong/dotfiles.git $HOME/.cfg.git- Define the alias in the current shell scope:
alias config='/usr/bin/git --git-dir=$HOME/.cfg/ --work-tree=$HOME'- Checkout the actual content from the bare repository:
config checkoutFor further help see the afore mentioned website.