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

  1. Initialize a Bare Git Repository
    • git init --bare $HOME/.dotfiles
  2. 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.. using nano
  3. Ignore untracked Files
    • dotfiles config status.showUntrackedFiles no
  4. Add your files to the git repo
    • dotfiles add ~./config/test
    • add files/folders as needed
  5. push to git remote
    • dotfiles remote add origin https://github.com/youruser/dotfiles.git
    • dotfiles push -u origin main

Restore

  1. Clone Repo
  2. create the alias (see step 2 in Setup)
  3. Checkout the files
    • dotfiles checkout
  4. Ignore untracked Files
    • dotfiles config status.showUntrackedFiles no

When git complains about existing files, move them somewhere else temporarily