Skip to content

fix: auto-resolve sync conflicts and preserve existing .gitignore#13

Merged
robmorgan merged 1 commit intomainfrom
fix/sync-conflict-resolution
Feb 10, 2026
Merged

fix: auto-resolve sync conflicts and preserve existing .gitignore#13
robmorgan merged 1 commit intomainfrom
fix/sync-conflict-resolution

Conversation

@robmorgan
Copy link
Copy Markdown
Owner

Summary

  • SyncToProjectDir now uses git merge -X theirs to auto-resolve merge conflicts in favor of upstream (agent) changes, fixing metamorph sync failures when scaffold files (PROGRESS.md, .gitignore) diverge between the project dir and upstream
  • metamorph init now appends to .gitignore instead of overwriting it, preserving any existing language-specific entries (e.g. /target, Cargo.lock)

Test plan

  • Existing tests pass (go test ./cmd/ ./internal/gitops/)
  • Updated conflict test now verifies upstream content wins instead of expecting an error
  • Manual test: run metamorph init in a project with an existing .gitignore and verify entries are appended, not overwritten
  • Manual test: create divergent PROGRESS.md between upstream and project dir, run metamorph sync, verify it succeeds with upstream version

🤖 Generated with Claude Code

metamorph sync (and periodic daemon syncs) would fail with merge
conflicts when the upstream repo and project dir had divergent versions
of scaffolded files like PROGRESS.md and .gitignore. This was caused by
InitUpstream creating scaffold files independently from metamorph init,
producing parallel histories that could never cleanly merge.

Two fixes:
- SyncToProjectDir now uses `git merge -X theirs` so conflicts
  auto-resolve in favor of upstream (agent work), which is the content
  being synced in.
- metamorph init now appends to .gitignore instead of overwriting it,
  preserving any existing language-specific entries.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
@claude
Copy link
Copy Markdown

claude bot commented Feb 10, 2026

Code review

No issues found. Checked for bugs and CLAUDE.md compliance.

@robmorgan robmorgan merged commit 4eaa5b0 into main Feb 10, 2026
2 checks passed
@robmorgan robmorgan deleted the fix/sync-conflict-resolution branch February 10, 2026 07:59
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant