Files
opencode/command/sync-oc-pull.md

2.1 KiB

description, agent
description agent
Pull latest OpenCode config changes from remote build

sync-oc-pull

Pull latest changes for OpenCode configuration from remote repository.

Use Cases

When you updated OpenCode configuration on another device, or team members shared new commands/configurations, use this command to sync to local.

Steps

1. Switch to OpenCode Config Directory

cd ~/.opencode

2. Check Local Status

Run git status to check if there are uncommitted local changes.

If there are uncommitted changes:

  • List changed files
  • Ask user how to handle:
    • Stash: git stash to save local changes, restore after pull
    • Discard: git checkout -- . to discard local changes
    • Cancel: Terminate operation, let user handle manually

3. Pull Remote Changes

git pull origin main

4. Handle Conflicts (if any)

If conflicts occur during pull:

  1. List conflicting files

  2. Open conflict files, analyze conflict content

  3. Ask user to choose:

    • Keep local version: Use git checkout --ours <file>
    • Use remote version: Use git checkout --theirs <file>
    • Manual merge: Prompt user to manually edit then execute git add <file>
  4. After resolving all conflicts, complete merge:

git add .
git commit -m "chore: resolve merge conflicts"

5. Restore Stashed Changes (if any)

If git stash was used in step 2:

git stash pop

If conflicts occur during restore, handle according to step 4.

6. Show Update Summary

After pull completes, show update content:

git log --oneline -5

List newly added or modified command files to help user understand what new configurations are available.

Notes

  • Backup important configs: If there are local modifications before pull, suggest backing up or using git stash first.
  • Conflict handling: Config file conflicts usually prioritize keeping local version, unless explicitly needing remote's new config.
  • Verify config: After pull, suggest checking if opencode.json and other config files work correctly.