What happened?
Description
Running multiple Qwen Code sessions in the same repository currently causes conflicts because all sessions operate on the same working directory and file state.
This issue proposes adding a --worktree flag that creates isolated Git worktrees for each session, allowing developers to run multiple Qwen Code instances in parallel without interfering with each other.
The implementation is inspired by Claude Code's worktree-based parallel session model.
Motivation
When developers run multiple AI-assisted coding sessions simultaneously, they often want each session to modify files independently.
Without isolation:
- Sessions overwrite each other's changes
- File state becomes inconsistent
- Experiments across multiple features become difficult
Using Git worktrees allows:
- Shared git history
- Fully isolated file states
- Parallel development workflows
Proposed Solution
Introduce a CLI flag:
When enabled, Qwen Code will automatically create and use a Git worktree for the session.
Behavior
- Validate the current directory is a Git repository
- Create a worktree under:
- Create a branch:
- Change the process working directory to the new worktree
- Start the Qwen Code session inside the isolated environment
Worktree naming
Two modes are supported:
Auto-generated name
Example generated worktree:
.qwen/worktrees/session-17482
Custom name
qwen --worktree feature-auth
Worktree path:
.qwen/worktrees/feature-auth
Branch:
Usage Examples
Single isolated session
qwen --worktree feature-auth
Auto-generated session
Multiple parallel sessions
qwen --worktree feature-a &
qwen --worktree feature-b &
Each session runs in its own independent working directory.
Features
- Auto-generated or custom worktree names
- Isolated working directories
- Dedicated branch per worktree
- Git repository validation
- Clear error handling and user feedback
Expected Outcome
Developers will be able to run multiple Qwen Code sessions concurrently, each operating on a fully isolated workspace while sharing the same Git repository history.
What did you expect to happen?
NA
Client information
NA
Login information
NA
Anything else we need to know?
NA
What happened?
Description
Running multiple Qwen Code sessions in the same repository currently causes conflicts because all sessions operate on the same working directory and file state.
This issue proposes adding a
--worktreeflag that creates isolated Git worktrees for each session, allowing developers to run multiple Qwen Code instances in parallel without interfering with each other.The implementation is inspired by Claude Code's worktree-based parallel session model.
Motivation
When developers run multiple AI-assisted coding sessions simultaneously, they often want each session to modify files independently.
Without isolation:
Using Git worktrees allows:
Proposed Solution
Introduce a CLI flag:
When enabled, Qwen Code will automatically create and use a Git worktree for the session.
Behavior
Worktree naming
Two modes are supported:
Auto-generated name
Example generated worktree:
Custom name
Worktree path:
Branch:
Usage Examples
Single isolated session
Auto-generated session
Multiple parallel sessions
Each session runs in its own independent working directory.
Features
Expected Outcome
Developers will be able to run multiple Qwen Code sessions concurrently, each operating on a fully isolated workspace while sharing the same Git repository history.
What did you expect to happen?
NA
Client information
NA
Login information
NA
Anything else we need to know?
NA