The goal of this tool is to make it simple to keep my development environment consistent across machines. I often will update a configuration on one machine, then wish I had it an another. This tool will allow marking certain files or directories, then pushing or pulling changes from a remote. This remote will likely be a github repo / gist, or other centralized location. There would still be the issue of forgetting to sync my changes, but having a single command should aid my laziness.
An alternative to this tool is keeping your configuration files in a dotfiles/ directory, then creating symlinks to the
locations they are expected to be in. This tool takes a less instrusive approach by keeping the source files where they
are, and allows you to easily grow and shrink the number of tracked files on the fly.
Install dot-sync using Go:
go install github.com/tylerkeyes/dot-sync@latestMake sure your $GOPATH/bin (or $GOBIN) is in your $PATH to run the dot-sync command.
Before using dot-sync, you need to initialize a storage provider (currently supports Git):
# Initialize Git storage with an existing remote repository
dot-sync storage init --provider git --remote-url https://github.com/your-username/dotfiles.gitThe typical workflow involves marking files for tracking, syncing them to remote storage, and pulling them on other machines:
1. Mark files and directories for syncing:
# Mark individual files
dot-sync mark ~/.vimrc ~/.bashrc
# Mark directories
dot-sync mark ~/.config/nvim ~/.ssh
# Mark files using relative paths (from current directory)
dot-sync mark .vimrc config/2. Sync your marked files to remote storage:
# Push all marked files to your configured remote
dot-sync sync3. Pull files on another machine:
# Pull and restore all synced files to their original locations
dot-sync pullView currently tracked files:
# List all files currently marked for syncing
dot-sync showRemove files from tracking:
# Remove specific files from sync tracking and remote storage
dot-sync delete ~/.old-config ~/.unused-script
# Remove directories from tracking
dot-sync delete ~/.config/old-app- New Machine Setup: Initialize storage, then
dot-sync pullto restore your entire development environment - Daily Sync: After updating configs, run
dot-sync syncto backup changes - Selective Syncing: Use
dot-sync markto add new configuration files as your setup evolves - Cleanup: Use
dot-sync deleteto remove outdated configurations from sync tracking
The tool automatically handles:
- Both files and directories
- Absolute and relative paths
- Directory structure preservation
- Conflict resolution during pulls
All tracked files are stored locally in ~/.dot-sync/files/ and synchronized with your configured remote storage.