---
key: process.foreign-worktree-plumbing-merge
title: 2026-07-21 — Never commit or merge inside a worktree you did not create (#542)
status: active
since: '2026-07-21'
supersedes: none
superseded-by: none
rule: Never commit or merge inside a worktree another session created; land the merge with git plumbing against the branch ref instead.
signals: 'sibling session worktree · branch already checked out · plumbing merge · read-tree · commit-tree · GIT_INDEX_FILE · paths: n/a · issues: #542'
mechanics: '`git read-tree -m <base> <ours> <theirs>` into a temporary `GIT_INDEX_FILE` → `git write-tree` → `git commit-tree -p <ours> -p <theirs>` → push the resulting commit to the branch ref. The owning session then `git pull`s it.'
---

With several sessions on one machine, any given branch may already be checked out in a sibling
session's worktree. Touching that checkout writes into another agent's working state; the plumbing
route mutates only the ref, so the merge lands without disturbing the owner's tree.
