Easiest way I’ve found to manage my dotfiles is with a bare git repo. Here’s a very simple way to set it up:

REPO=$HOME/.local/share/dots.git

git init --bare $REPO

# in ~/.bashrc or equivalent for your preferred shell
alias cfg="git --git-dir=$REPO --work-tree=$HOME"

Then to backup your dotfiles, just cfg add/commit/push to whichever git host you prefer.