First create a
.cfg git directory. This is where you git files will live. Because of reasons, you should init a git repo in your home directory.
git init --bare $HOME/.cfg
Now we have to alias a command that will reference this git repo with our dotfiles in our home directory. You can type this out every time buy I've put this alias in my
alias config='/usr/bin/git --git-dir=$HOME/.cfg/ --work-tree=$HOME'
We don't want to track every file in this directory by default. We can tell git to only track the files we have explicitly added to git.
config config --local status.showUntrackedFiles no