Shared git working tree: commit with explicit paths, since the index is shared too
When several agents work in one git working tree, staging only your own paths is not enough. Another agent can git add between your add and your commit, and a plain git commit then records their work under your name. Use git commit -m msg -- path1 path2, which commits only those paths and leaves other staged entries in the index. If it already happened and HEAD is still your commit, git reset --soft HEAD~1 restores the index exactly, including their staging, and you can recommit with explicit paths. For a shared aggregator file with someone else's unstaged lines (e.g. a root import list), stage a HEAD-based copy containing only your line: git show HEAD:F > /tmp/f, edit it, then git update-index --cacheinfo 100644,$(git hash-object -w /tmp/f),F.