Why version your dotfiles?
Your ~/.zshrc, ~/.gitconfig, ~/.ssh/config, and a dozen others are your computer's personality. Lose them and a new Mac feels alien for days. Keep them in git and you can replicate yourself in 10 minutes.
The plain-git approach
cd ~
git init --bare $HOME/.dotfiles.git
alias config='/usr/bin/git --git-dir=$HOME/.dotfiles.git --work-tree=$HOME'
config config status.showUntrackedFiles no
config add .zshrc .gitconfig .config/starship.toml
config commit -m 'starting'
config push -u origin mainThis treats your home as a working tree but only tracks the files you explicitly add. Restore on a new Mac with the same alias plus config checkout.
chezmoi — a dedicated tool
brew install chezmoi. chezmoi init https://github.com/me/dotfiles. Files live in a separate source dir, chezmoi apply writes them to your home. Templates, secrets via password managers, OS-conditional content. The most popular dotfile manager.
GNU Stow — symlink farms
brew install stow. Organize dotfiles in a ~/dotfiles/zsh/ tree mirroring home; stow zsh creates symlinks from ~/.zshrc back into the repo. Light, no template engine.
What to track, what not to
- Track: .zshrc, .gitconfig, .ssh/config (no keys), .config/{starship,nvim,fish}, .vimrc, .tmux.conf, .editorconfig, .gitignore_global.
- Skip: .env, .ssh/id_*, .ssh/known_hosts, anything in .cache, .npm, .pyenv, .docker. State and secrets aren't config.
Pippa pattern
The Pippa fleet keeps an office-Mac-as-source-of-truth model. Office writes new dotfile changes; peers fan out via fleet-deploy scripts that verify with sha256. The principle is the same as chezmoi: one repo, many machines, idempotent restore.