Idea: make $HOME the git work-tree, with a bare repo in a dummy folder (.dotfiles
).
The git commands use .dotfiles
as the git directory, and $HOME
as the work directory.
- create "bare" repository
- don't contain working tree aka copy of source files
- store git revision history in root folder of repo instead of
.git
subfolder
mkdir $HOME/.dotfiles
git init --bare $HOME/.dotfiles
- setup alias to run git commands in this repo (in
.zshrc
)
alias dotfiles='/usr/bin/git --git-dir=$HOME/.dotfiles/ --work-tree=$HOME'
- add remote
dotfiles config --local status.showUntrackedFiles no
dotfiles remote add origin git@github.com:amitiuttarwar/amus_dotfiles.git
- use
dotfiles
instead ofgit
command whenever working with this repo. - can arbitrarily add files to push.