You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
[FEATURE]: Support custom branch names when creating workspaces (worktrees) #20950
I have verified this feature I'm about to request hasn't been suggested before.
Describe the enhancement you want to request
Current Behavior:
When creating a new workspace (git worktree) through OpenCode's UI or API (POST /experimental/worktree), the branch name is automatically generated as opencode/<slugified-name>. Users cannot specify a custom branch name like feature/my-branch or bugfix/issue-123.
Use Case:
In many development workflows, teams use specific branch naming conventions (e.g., feature/, bugfix/, hotfix/ prefixes). The current auto-generated opencode/<name> format doesn't align with these conventions, making it harder to:
Follow team branch naming policies
Integrate with CI/CD pipelines that expect certain branch patterns
Organize branches logically in git history
Workaround (Temporary Solution):
Currently, users can manually create a worktree with a custom branch name and register it in OpenCode:
# 1. Manually create worktree with custom branch name
git worktree add -b feature/my-custom-branch /path/to/worktree
# 2. Register it in OpenCode's database by updating the project sandboxes field
However, this requires manual database manipulation and is not user-friendly.
Proposed Solution:
Extend the workspace creation API to accept an optional branch parameter:
POST /experimental/worktree
{
"name": "my-workspace",
"branch": "feature/my-custom-branch"
}
If branch is provided, use it directly (after validating it doesn't already exist). If not provided, fall back to the current auto-generated opencode/<name> format.
Additional Context:
Looking at the code in packages/opencode/src/worktree/index.ts, the CreateInput schema and makeWorktreeInfo function would need to be modified to accept and use a custom branch name.
Activity
github-actions commentedon Apr 4, 2026
This issue might be a duplicate of existing issues. Please check:
KingingWang commentedon Apr 4, 2026
#13592