# Shared-repository collaboration and conflict resolution Read on demand for resolve-conflicts. Git is the history/integration mechanism; this skill is an engineering procedure, not a distributed lock service. ## Prevention and ownership Each person uses their own clone. Concurrent sessions on one machine should use different task branches and worktrees (or clones). Do not have two people/agents edit the same checkout simultaneously. A worktree isolates working files and index but shares repository refs/objects/config; it does not eliminate semantic conflicts. Agree a narrow task scope, file/component owners, interface contract and integration order. Keep PRs small, integrate frequently according to team policy and review after integration. Do not assume remote main is current from local tracking refs. Use docs/project/collaboration/.md for task-specific scope/ownership/hand-off notes rather than making every worker append continuously to shared STATE.md. Choose one integrator to reconcile the shared state at integration points. These notes are advisory; server protections, required reviews/checks, CODEOWNERS and merge queues need repository-host configuration and explicit authorization. No remote messages/settings are changed by this skill. ## Inspect first ```sh python3 .claude/framework/collaboration.py status ``` The global --target option precedes status for another explicit worktree root. Exit 0 means no active detected operation/unmerged entries (the tree may still be dirty); 2 means an operation/conflict needs attention; 1 means invalid Git/path/tool input. The read-only helper lists actual unmerged stages including rename/add/delete situations, resolves metadata paths through Git (including linked worktrees), disables optional Git locks/fsmonitor, and does not inspect file contents or execute a remote action. It reports no remote freshness or semantic merge guarantee. Inspect `git status`, relevant diffs/history and contracts before mutations. No operation: determine actual integration target and team strategy; preserve dirty work through an agreed scoped commit or separate worktree before starting integration. Never auto-stash or stash-pop mixed work. Active merge/rebase/cherry-pick/revert: finish or explicitly abort that operation before starting another. Do not enable repository/global settings such as rerere automatically. For a planned new worktree, after checking names, destination and ownership, this is an illustrative local command: ```text git worktree add -b task/booking ../booking-worktree ``` Replace the base with an inspected existing ref; never paste placeholders into a shell. Do not force reuse of an already checked-out branch. A remote fetch may use credentials and is a separate authorized action; local tracking branches alone cannot prove freshness. ## Resolve intent, not just conflict markers Use the conflict's actual index entries and ancestor/history to understand what each collaborator intended. Git stage 1 is the base when present; stage 2/3 are sides. During rebase, ours is the rebased/upstream series and theirs is the replayed working-branch change, so everyday branch labels can mislead. Inspect actual commits instead of choosing ours/theirs by habit. Some add/delete conflicts have no base or one missing side; renamed paths may have entries under different names. Do not assume every conflict is a three-section text marker. For each path: identify both behavioral changes, check the owning requirement/API, combine compatible intent, and test that both remain true. If requirements contradict, ask the relevant owner/user rather than invent acceptance. Do not contact collaborators using external tools unless explicitly instructed. Resolve only agreed paths, inspect full context and resulting diff, then stage explicit reviewed paths. No blanket side selection, auto-union or recursive “keep newest” rule. ## File-specific rules | Conflict | Resolution approach | |---|---| | Code/tests/API | Preserve both supported behaviors; inspect callers/contracts and add targeted regressions. Text can merge cleanly while behavior conflicts. | | Rename/delete or binary | Confirm intended new path/lifecycle and references; request material owner intent. Do not silently restore or delete. For binaries choose an authoritative source/regeneration route with rationale. | | Generated assets | Reconcile source first, regenerate with existing approved tooling, inspect output; never hand-merge binary output. | | Package manifests/lockfiles | Reconcile intended dependencies/versions first. Regenerate only with the approved version/tooling and authorization for any install/network/third-party execution. Never blindly take one lockfile side. | | Database migrations | Inspect actual deployment/application history. Preserve applied migration identity; coordinate ordering/unique IDs and add a forward migration when needed. Do not silently rewrite an applied migration or run a database command. | | ADRs / design.json | Keep distinct decisions and unique identifiers, fix references, explicitly supersede conflicting accepted decisions only with owner agreement. Confirmation/schema-hash records must be revalidated; never union confirmations into manufactured approval. | | STATE.md / ROADMAP.md | Integrator reconciles actual completed work, unresolved blockers and next action; keep pending/unverified items visible. Recheck source-bound evidence after integration rather than combining old passing claims. | | Review journals / task notes | Use task-specific identifiers. Preserve provenance and both findings; re-review integrated source. Different branches may reuse the same id, so resolve collisions explicitly. | | .claude settings / rules / skills | Review effective permissions/hooks and instruction ownership. Do not union tool grants, duplicate hooks or relax policy as a conflict shortcut; unknown settings remain unverified. | | Secrets / local state / manifests | Do not copy secret-bearing content into notes/logs or version control. Managed ownership manifests and ignored local config are machine-local; do not share/merge them. | ## Verify and finish Check the unmerged index again; staged resolution removes entries but does not prove correctness. Inspect staged and unstaged diffs separately, use `git diff --check` / `git diff --cached --check`, and inspect remaining marker-like lines on affected paths (legitimate examples may contain markers). Run actual integration-target checks, including compatible API/schema behavior where relevant. Empty gates, marker removal and no textual conflicts cannot prove application success. Use iteration-review for meaningful semantic changes, with at most two review/fix rounds total. Record inspected revision, both intents, resolution/rationale, explicit paths staged, executed checks/exits, unresolved findings and recovery plan. Do not stage unrelated changes or record secrets. Continuing the authorized operation may invoke existing Git hooks/signing/editor settings; inspect project policy and do not bypass hooks, use credentials or waive a check silently. If another replayed commit conflicts, repeat scoped inspection and report further blockers rather than auto-skipping it. No push, shared history rewrite or server-side merge occurs implicitly. Abort is not a guaranteed backup: Git may not recover pre-existing uncommitted edits, especially after further edits. Preserve later work and request/confirm abort intent before using the appropriate active-operation abort command. Never use reset --hard, clean or force-push as a recovery shortcut. If intent or recovery is unclear, stop mutations and report the evidence and smallest required decision. ## Sources and qualification Verified reference sources on 2026-12-01: [Git merge](https://git-scm.com/docs/git-merge), [Git rebase](https://git-scm.com/docs/git-rebase), [Git worktree](https://git-scm.com/docs/git-worktree). Local Git: 2.54.0 (Apple Git-157). Git operation/stage semantics are native; file ownership, evidence and ADR reconciliation are Foundry procedure. The helper is locally tested; live model resolution quality and remote branch-policy enforcement are unverified.