Set things up with a bare git repository. This technique has been described in many different ways:
- Manage dotfiles with a git bare repository
- The best way to store your dotfiles: A bare Git repository
- Google.
First, create your bare repository
git clone --bare [email protected]:amalgamet/.dotfiles.git ~/.dotfiles.git
Then create an alias to use git with this bare repository. You'll also want to hide untracked files, since the dotfiles live in your $HOME
directory.
alias dotfiles='git --git-dir=$HOME/.dotfiles.git/ --work-tree=$HOME'
dotfiles config --local status.showUntrackedFiles no
With this newly-created dotfiles
alias, you can perform normal git commands without passing the --git-dir
and --work-tree
flags.
dotfiles checkout
dotfiles submodule update --init --recursive
dotfiles status