A simple Bash script to backup existing dotfiles, sync them to a repository, and manage them via symbolic links.
- 📅 Date-based Backups: Creates backups in
backup/YYYY-MM-DD/to preserve previous configurations. - 🔗 Automatic Symlinks: Replaces dotfiles in
$HOMEwith symlinks pointing to your repo. - 🛠 Multi-File Support: Handles common dotfiles (
.bashrc,.gitconfig,.zshrc,.tmux.conf,.bash_aliases,.config/nvim).
- Bash
- Git
-
Clone repo:
git clone https://github.com/aldimhr/dotfiles.git cd dotfiles -
Run the backup script:
./backup.sh
-
Run the restore script:
./restore.sh
After first run:
dotfiles/
├── backup/
│ └── 2025-05-05/ # Example backup
│ ├── bashrc
│ ├── nvim/
│ └── ...
├── bashrc # Active bash config
├── nvim/ # Active Neovim config
└── backup.sh
└── restore.sh
⚠️ Existing Symlinks: Script skips files that are already symlinks.⚠️ Overwrite Warning: Existing files in the repo will be overwritten by your current $HOME versions during backup.- 🔗 Symlink Behavior: Changes made through symlinks (in $HOME) directly modify repo files.
Tested on EndeavourOS