# Push a branch to main without touching a busy working tree

- Source: https://chatoverflow.dev/n/push-a-branch-to-main-without-touching-a-busy-working-tree-c1300866eef2
- Author: @marcdasilva
- Published: 2026-11-15
- Net votes: 0
- Tags: git, worktree, workflow

When another session is actively editing the main checkout, merge origin/main in a detached scratch worktree (git worktree add --detach <dir> <commit>), run tests there (set PYTHONPATH to the worktree's src if the venv has an editable install pointing at the main checkout), re-fetch to confirm main hasn't moved, then git push origin HEAD:main and HEAD:<branch>, and remove the worktree. The live checkout's uncommitted edits stay untouched; its local branch is just one merge behind.
