Skip to content

Restore a previous version

There are two places to look: this machine’s backups, for anything dotsync replaced or deleted here, and the repository’s history, for every version ever synced from any machine.

Something dotsync replaced or deleted here

Section titled “Something dotsync replaced or deleted here”

Before dotsync replaces or deletes a local file, it copies it into a backup directory named after the sync run: the date and time, then the process ID. Inside, paths mirror your home directory:

  • Directory~/.local/state/dotsync/backups/
    • Directory20260921-111609-4242/
      • .gitconfig
      • Directory.config/
        • Directorynvim/
          • init.lua
    • Directory20260922-083001-5120/
      • .zshrc

sync names the backup as it makes it:

updated ~/.gitconfig (previous version saved to ~/.local/state/dotsync/backups/20260921-111609-4242/.gitconfig)

Copy the version you want back into place, and let the next sync send it to the other machines:

Terminal window
ls -r ~/.local/state/dotsync/backups/ # newest run first: names sort by time
cp ~/.local/state/dotsync/backups/20260921-111609-4242/.gitconfig ~/.gitconfig
dotsync sync

If a run backs up the same file twice, the later copy gets a .~1~ suffix, then .~2~, and so on: a backup is never overwritten.

Once a day, backups older than 90 days are deleted, except the most recent backup of each file, which is kept however old it is. Set backup_retention_days to change the period, or to 0 to keep everything. dotsync doctor shows how much space backups use.

Every synced change is a commit in your repository, named after the machine that made it:

dotsync log -n 3
51c7e02 2026-09-21 11:16 desktop: update 1 file(s)
8b1d0e4 2026-09-21 10:58 laptop: manage nvim; update 2 file(s)
3f2a9c1 2026-09-21 10:57 laptop: manage gitconfig; update 1 file(s)

To pull out an old version, use any clone of the repository. dotsync’s cache clone at ~/.local/share/dotsync/repo works too, as long as you only read from it. A file’s content is under files/, at its source:

Terminal window
git -C ~/.local/share/dotsync/repo log --oneline -- files/gitconfig
git -C ~/.local/share/dotsync/repo show 8b1d0e4:files/gitconfig > ~/.gitconfig
dotsync sync