- Clone your dotfiles into a bare repository in a "dot" folder of your $HOME:
git clone --bare https://github.com/nicomellon/dotfiles.git $HOME/.cfg
- 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 to your $HOME:
config checkout
The step above might fail with a message like:
error: The following untracked working tree files would be overwritten by checkout:
.bashrc
.gitignore
Please move or remove them before you can switch branches.
Aborting
This is because your $HOME folder might already have some stock configuration files which would be overwritten by Git. The solution is simple: back up the files if you care about them, remove them if you don't care.
- Set the flag showUntrackedFiles to no on this specific (local) repository:
config config --local status.showUntrackedFiles no
done!