Instructions for managing your dotfiles with Git. Works in Linux and Windows.
Steps
Checkout bare repository
git clone --bare <remote-git-repo-url> <checkout-dir>-
replace
<remote-git-repo-url>with the repository URL -
replace
<checkout-dir>witht he checkout location (NOT the home folder)
Add alias to Git global config
git config --global alias.dotfiles '!git --git-dir=<checkout-dir> --work-tree=<home-dir>'-
replace
<checkout-dir>with the chckout location -
replace
<home-dir>with the home folder (e.g./home/brewsterorc:/users/brewster)
Checkout
git dotfiles checkoutNext steps
Create a branch for the new machine
git dotfiles checkout -b 202409-new-machine-nameMake changes specifically for this new-machine-name
git dotfiles add ~/.config/app/app.config
git dotfiles commit -m "added new app config file"
git dotfiles pushIf changes are applicable to all environments, merge into main via a feature branch with a single commit.
Windows example
Make sure to use forward-slashes in alias paths:
git clone --bare https://github.com/myname/dotfiles C:\Users\myname\repos\dotfiles
git config --global alias.dotfiles '!git --git-dir=c:/users/myname/repos/dotfiles --work-tree=c:/users/myname'
git dotfiles checkout