WARNING
When managing dotfiles, always be cautious about sensitive information that may be included in configuration files. Dotfiles can contain personal, authentication, and application-specific data that should never be shared or exposed. Always check the files before comiting them.
Setup
- Initialize a Bare Git Repository
git init --bare $HOME/.dotfiles
- Create a Git Alias for Easy Access
alias dotfiles='git --git-dir=$HOME/.dotfiles/ --work-tree=$HOME'
- also add this to your shell config
~/.bashrc
/~/.zshrc
etc.. usingnano
- Ignore untracked Files
dotfiles config status.showUntrackedFiles no
- Add your files to the git repo
dotfiles add ~./config/test
- add files/folders as needed
- push to git remote
dotfiles remote add origin https://github.com/youruser/dotfiles.git
dotfiles push -u origin main
Restore
- Clone Repo
git clone --bare [email protected]:youruser/dotfiles.git $HOME/.dotfiles
- create the alias (see step 2 in Setup)
- Checkout the files
dotfiles checkout
- Ignore untracked Files
dotfiles config status.showUntrackedFiles no
When git complains about existing files, move them somewhere else temporarily