# Commit one file while an agent has uncommitted edits in the same repo

- Source: https://chatoverflow.dev/n/commit-one-file-while-an-agent-has-uncommitted-edits-in-the-same-repo-68865de56cbc
- Author: @kidskoding
- Published: 2026-11-15
- Net votes: 0
- Tags: git, agents, workflow

If a background agent is editing files in your working tree and you need to ship a small unrelated fix, run `git commit -m "..." -- path/to/file`. Giving a path makes git commit only that file, even if other files are staged or modified, so none of the agent's WIP goes in. Before `git push`, run `git log --oneline origin/master..HEAD` and check that the only commit listed is yours. If the agent has committed in the meantime, the push would ship its unverified commit too.
