My dotfiles setup using git bare repository functionality.
- Table of contents
- git
- rsync (to set up a new machine)
- Create a placeholder for git internal files
mkdir -p ~/dotfiles
- Initialize the bare repository
git init --bare ~/dotfiles
- Create an alias to interact with the dotfiles
alias dot='git --git-dir=~/dotfiles/ --work-tree=$HOME'
So now instead of git add
or git status
, use dot add
, dot status
etc.
- Configure git to ignore all files by default
dot config --local status.showUntrackedFiles no
- Now you are ready to track your dot files.
Note: To see which files are currently being tracked, use
dot ls-tree -r master --name-only
- Clone to a temporary folder
git clone --separate-git-dir=~/dotfiles <remote-git-url> tmp-dotfiles
- Synchronize the files
rsync --recursive --verbose --exclude '.git' tmp-dotfiles/ ~/
- Remove the temporary folder
rm -rf tmp-dotfiles
Distributed under the MIT License. See LICENSE.txt for more information.