Skip to main content
gat init installs that sync managed files after common Git operations. Sync uses the local cache by default and reports conflicts instead of discarding local edits. For the cache, lock, and working-file relationship, see how sync decides what to change.

Which Git operations trigger sync?

After git reset --hard, git restore, or git read-tree -u, run gat sync yourself. If a merge stops for conflicts, resolve them and sync explicitly.
This removes Gat’s managed hook blocks while preserving other hook code and the lock merge driver. Run gat init to install the hooks again.

Choose when to fetch

Fetch missing objects and update working files. Use this after a branch switch if the required content is not cached.
gat sync --fetch enables fetching for one run. gat fetch only downloads objects; it leaves working files unchanged.

Local changes and conflicts

Preview the planned updates, removals, conflicts, and missing objects:
Save a separate copy of any local work you need. For repository-owned files, run gat add PATH to record the edited contents, then commit gat.lock. For mounted files, make changes in the source repository instead.

Working-tree validation

Sync checks first and hashes content when needed. gat status compares tracking metadata; it does not inspect payload edits.
When the lock and agree, this skips inspecting the corresponding working file. External edits or deletions can be missed.Use only when that tradeoff is acceptable. See Performance tuning.

Missing and corrupted objects

Run gat pull. If the remote also lacks the object, upload it with gat push from a clone that still has the content.Check the selected remote with gat status --remote and review provider credentials if access fails.
If the remote has a good copy, fetch a replacement:
Add --remote NAME to choose a remote. Set sync.auto_repair to true to allow repair during future syncs. Ordinary working-file edits are handled as local changes, separately from cache corruption.

Limit automatic sync to selected paths

Hooks honor the default named selection. Without one, they select all paths. To save a personal working set, use the experimental selection command:
Excluded paths are not updated and may retain an older version. For a one-time override, use gat sync --path models; --path . selects the whole repository.

Sync options

Fetch, repair, preview, and rematerialize.

Path selection

Save filters and choose defaults.