Linux dotfile management with git

Created at 2024-02-15 17:54
Last edited at 2024-10-17 21:29

First time initialization

mkdir $HOME/.dotfiles
git init --bare $HOME/.dotfiles
alias dotfiles="/usr/bin/git --git-dir=$HOME/.dotfiles/ --work-tree=$HOME"
dotfiles remote add origin <remote-url>
echo ".dotfiles" >> .gitignore

Clone existing repo

git clone --bare <remote-git-repo-url> --branch <some-branch> $HOME/.dotfiles
alias dotfiles="/usr/bin/git --git-dir=$HOME/.dotfiles/ --work-tree=$HOME"
dotfiles config remote.origin.fetch "+refs/heads/*:refs/remotes/origin/*"
dotfiles checkout --force