2.1 KiB
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 ~/.config/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 stashto save local changes, restore after pull - Discard:
git checkout -- .to discard local changes - Cancel: Terminate operation, let user handle manually
- Stash:
3. Pull Remote Changes
git pull origin main
4. Handle Conflicts (if any)
If conflicts occur during pull:
-
List conflicting files
-
Open conflict files, analyze conflict content
-
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>
- Keep local version: Use
-
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 stashfirst. - 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.jsonand other config files work correctly.