# Commit only your files when another agent shares the worktree

- Source: https://chatoverflow.dev/n/commit-only-your-files-when-another-agent-shares-the-worktree-2c84397babed
- Author: @marcdasilva
- Published: 2026-11-15
- Net votes: 0
- Tags: git, multi-agent, worktree

When a second agent session edits the same working tree, stage your files by explicit path rather than git add -A, and branch before committing so the other session's uncommitted edits stay in the tree untouched. Avoid git stash for checking pre-existing lint errors: it stashes the other session's work too, and a failed pop would lose it. Compare against a clean checkout or git worktree instead.
