Manage dotfiles with git

I watched a video by DistroTube where he showed how to manage your dotfiles with a git bare repository. I've been using this strategy for quite some time now, and I'm very pleased with it, so here is what I've done...

Prepare/install

Create cache directory and init git bare repo:
mkdir -p $HOME/.cache/df-git
git init --bare $HOME/.cache/df-git
Add an alias to your shell:
alias df-git='git --git-dir=$HOME/.cache/df-git --work-tree=$HOME'
Reload your shell the command below, it will be much easier if you only manage the files you specifically add yourself.
df-git config --local status.showUntrackedFiles no
Connect to a remote repository, there are several alternatives like Github, Gitlab and the likes of them, follow their instructions, but usedf-git wherever they tell you to use git.

Usage

You get all the power you get with git, you just have to remember to use df-git instead of the normal git.
Examples:
df-git add /path/to/file
df-git commit -m "Some message describing the change"
df-git push
2020-07-27Kenneth HedmanEnglishLinux