Just use `git` to manage your dotfiles
10 days ago
- #dotfiles
- #git
- #version-control
- Dotfile managers like chezmoi, stow, and yadm exist but require tool installation and command learning.
- Git can be used to version and sync dotfiles without additional tools by ignoring all files and force-adding desired ones.
- Initialize a git repo in the home directory, ignore all files with a .gitignore, and force-add the .gitignore file.
- Force-add dotfiles you want to track using `git add -f` or create an alias like `track-file` for easier use.
- To sync dotfiles to a new machine, initialize git, add the remote repository, and pull the dotfiles.
- Handle machine-specific configs with host-based conditions in shell configuration files like .zshrc or .bashrc.