docs: document sync export/import and updated snapshot layout

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
Breadway 2026-05-16 22:17:26 +08:00
parent 4072f64fcb
commit 23bb4f8977
2 changed files with 83 additions and 32 deletions

View file

@ -201,14 +201,19 @@ bread modules update [name] # Re-install one or all GitHub-sourced mod
bread modules info <name> # Show full manifest and daemon status
# Sync
bread sync init # Initialize sync for this machine
bread sync push # Snapshot and push current state to remote
bread sync pull # Pull and apply latest state from remote
bread sync init # Initialize sync for this machine (remote optional)
bread sync push # Commit local snapshot
bread sync push --message "note" # Commit with a custom message
bread sync pull # Apply local snapshot to this machine
bread sync pull --install-packages # Also install packages from snapshot
bread sync status # Show what has changed since last push
bread sync diff # Show file-level diff vs last commit
bread sync diff --remote # Show diff vs remote
bread sync machines # List known machines from sync repo
bread sync export # Create a portable .tar.gz snapshot (no git auth)
bread sync export --output path # Export to a specific file or directory
bread sync import <path> # Apply a portable snapshot (.tar.gz or directory)
bread sync import <path> --install-packages # Also install packages
bread sync import <path> --no-clone-repos # Skip cloning git repos
```
---
@ -266,27 +271,31 @@ return M
## Sync system
Bread sync snapshots your entire setup — Bread config, arbitrary dotfiles, and package lists — and stores it in a Git repository. Pull it on another machine to restore.
Bread sync snapshots your entire setup — Bread config, dotfiles, fonts, systemd units, package lists, and git repos — into a local Git repository. Use `export`/`import` to move state between machines without needing a git remote.
```bash
# First-time setup
# First-time setup (remote is optional)
bread sync init
bread sync init --remote git@github.com:you/bread-config.git
# Push current state
# Commit a local snapshot
bread sync push
# On another machine: pull and apply
bread sync pull
# Create a portable .tar.gz (no git auth required)
bread sync export
# Check what's pending
bread sync status
# On another machine: apply the snapshot
bread sync import bread-export-hermes-2026-05-16.tar.gz
# Also install packages on import
bread sync import bread-export.tar.gz --install-packages
```
Configure what gets synced in `~/.config/bread/sync.toml`:
```toml
[remote]
url = "git@github.com:you/bread-config.git"
url = "git@github.com:you/bread-config.git" # optional
branch = "main"
[machine]
@ -302,14 +311,21 @@ include = ["~/.config/nvim", "~/.config/waybar"]
exclude = ["**/.git", "**/*.cache"]
```
The sync repo stores:
A portable export snapshot contains:
```
sync-repo/
├── bread/ ← ~/.config/bread/ snapshot
├── configs/ ← delegate paths (nvim, waybar, etc.)
bread-export-hermes-2026-05-16/
├── bread/ ← ~/.config/bread/
├── configs/ ← hypr, nvim, kitty, waybar, fish, dunst, btop, …
├── dotfiles/ ← .gitconfig, .zshrc, .zprofile, .zshenv, ssh config, …
├── local-bin/ ← ~/.local/bin/ scripts
├── local-fonts/ ← ~/.local/share/fonts/
├── systemd/ ← ~/.config/systemd/user/ units
├── system/ ← udev rules, modprobe, sysctl (sudo required for some)
├── packages/ ← pacman.txt, pip.txt, cargo.txt, npm.txt
├── machines/ ← per-machine profiles
└── packages/ ← package snapshots (pacman.txt, pip.txt, etc.)
├── manifest.toml ← path map for exact restore
└── restore.sh ← shell script for manual restore
```
---