My personal dotfiles, managed using a bare Git repository.
This setup uses a bare Git repository stored in ~/.cfg with the working tree set to $HOME. This allows tracking dotfiles directly in the home directory without symlinking or additional tools.
The key is a config alias that wraps git commands:
alias config='/usr/bin/git --git-dir=$HOME/.cfg/ --work-tree=$HOME'This lets you run git commands like config status, config add, config commit, etc. to manage your dotfiles.
.zshrc- Zsh configuration (aliases, prompt, plugins, etc.).config/- Application configurationsLibrary/- macOS application settings
git clone --bare git@github.com-davidarthurthomas:davidarthurthomas/dots.git $HOME/.cfgalias config='/usr/bin/git --git-dir=$HOME/.cfg/ --work-tree=$HOME'config checkoutIf you get errors about existing files that would be overwritten:
# Back up conflicting files
mkdir -p .config-backup
config checkout 2>&1 | grep -E "^\s+\." | awk {'print $1'} | xargs -I{} mv {} .config-backup/{}
# Then retry checkout
config checkoutHide untracked files (so config status only shows tracked files):
config config --local status.showUntrackedFiles noAdd this line to your ~/.zshrc or ~/.bashrc:
alias config='/usr/bin/git --git-dir=$HOME/.cfg/ --work-tree=$HOME'Once set up, use the config alias just like git:
# Check status
config status
# Add a file
config add .vimrc
# Commit changes
config commit -m "Add vimrc"
# Push to remote
config push
# Pull updates
config pullconfig add ~/.some-config-file
config commit -m "Add some-config-file"
config push