# Workflow: Opening a Mod on Another Device

> How opening a GitHub-linked mod re-syncs missing and changed files from your repo automatically, without ever overwriting edits you haven't pushed yet.

- Source: https://diceytable.com/docs/editor/workflows/open-on-another-device
- Last verified: 2026-07-27

This page explains what happens automatically when your local browser draft doesn't already have
every file your mod needs — a new browser, a second computer, or a draft that was cleared or
evicted (see [Where my files live](https://diceytable.com/docs/editor/workflows/where-my-files-live)).

## What triggers it

**Only mods linked to a GitHub repository can recover this way.** Opening a GitHub-linked mod in
Edit Mode always re-syncs its file tree down into your local draft
(`syncDraftFromGithub`, `TableEditModeShell.tsx`, calling `githubSync.ts`) —
whether your draft is empty (second device), partially empty (some files evicted), or already
complete (in which case nothing downloads).

## How the sync decides what to do, per file

For every file in the repo's tree, compared against your local copy by **git blob sha** (not by
timestamp):

| Situation | Action |
|---|---|
| Missing locally | **Downloaded** — this is what repopulates empty explorer folders. |
| Present locally, identical sha | **Skipped.** Nothing to do. |
| Present locally, different sha, and your local copy hasn't changed since its last sync | **Downloaded** (a clean update — GitHub moved on and your copy is safe to replace). |
| Present locally, different sha, **and you've edited it locally since the last sync** | **Kept as-is — flagged as a conflict, never overwritten.** |

That last row is the guarantee this whole mechanism exists to provide: **a locally-dirty file is
never silently clobbered by a sync**, whether the "local" edit is from a browser session that
never got a chance to publish, or one you're actively mid-edit on right now
(`decideSyncAction`, `apps/web/src/publish/githubSync.ts`).

## What this feels like

The editor opens immediately — you're not blocked waiting for the sync. The runtime's asset
resolver falls back to loading directly from GitHub raw for anything not yet primed locally, so
objects still render while files land in the background. A status line reports progress
(*"Syncing files from GitHub… 4/12"*) as downloads complete, and the asset explorer repopulates
its folders live as each file arrives — no manual refresh needed.

If GitHub is unreachable (offline, rate-limited, a network failure), the sync fails gracefully:
whatever you have locally stays exactly as it is, a non-fatal notice appears, and **the draft is
never wiped**.

## Definition of done

Every file present in the repo either exists locally with a matching sha, or is deliberately
preserved as a local edit newer than the last sync. The explorer shows every folder populated,
not empty.

## If something looks wrong

- **A file you know you changed on another device isn't showing here.** Check whether it was
  actually pushed from that device (a checkpoint or publish) — the sync only ever pulls what's
  really on GitHub, not what's sitting unpushed in another browser's local draft.
- **You expect a file to have updated but it looks unchanged.** If you'd edited that same file
  locally since the last sync, it's a conflict and was deliberately left alone — see the table
  above. Re-download it manually if you want to discard your local copy in its favor.

## See also

- [Where my files live](https://diceytable.com/docs/editor/workflows/where-my-files-live)
- [Connect GitHub](https://diceytable.com/docs/mods/publishing/github-setup)
- [wip and main](https://diceytable.com/docs/mods/publishing/wip-and-main)
