Skip to content

[FEATURE]: Ability to Change Git branches from Desktop App #31273

@RavdeepAulakh

Description

@RavdeepAulakh

Feature hasn't been suggested before.

  • I have verified this feature I'm about to request hasn't been suggested before.

Describe the enhancement you want to request

Summary:

It would be useful to have the ability to switch branches in a workspace chat directly from the Desktop App UI as shown in the image below:

Image

this would be beneficial for workflow as you would just be able to create a new chat in a workspace and switch branches right from the UI instead of having to start a new chat and open the terminal to switch branches. This ticket could also be extended in the future to integrate some other basic git functionality in the UI like fetching, pulling, creating a new branch etc.

This is not a duplicate as other issues have described this functionality as apart of a larger git system but those issues were closed without the implementation going through. This issue simply focuses on the ability to change branches.

Proposed Implementation

Server

  1. packages/core/src/git.ts — Add listBranches(dir) to Git.Interface that runs git branch --format='%(refname:short)'
  2. packages/opencode/src/project/vcs.ts — Add branches() and switchBranch(branch) methods to Vcs.Interface (reuses existing git.checkout())
  3. packages/opencode/src/server/routes/instance/httpapi/ — Add two new endpoints: GET /vcs/branches and POST /vcs/switch

Client

  1. New: packages/tui/src/component/dialog-branch-switch.tsx — A DialogSelect-based component that lists branches and switches on selection
  2. packages/tui/src/routes/session/sidebar.tsx — Show current branch next to workspace label; clicking opens the branch dialog
  3. Regenerate SDK via ./packages/sdk/js/script/build.ts

Branch changes are automatically reflected in the UI via the existing vcs.branch.updated event.

Metadata

Metadata

Assignees

Labels

No labels
No labels

Type

No type
No fields configured for issues without a type.

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions