[PR #7863] feat(web): show recent git branches in new session dropdown #12539

Closed
opened 2026-02-16 18:17:26 -05:00 by yindo · 0 comments
Owner

Original Pull Request: https://github.com/anomalyco/opencode/pull/7863

State: closed
Merged: No


Summary

  • Add recent git branches to the "New session" dropdown for quick branch switching
  • Users can now see and checkout recent branches without leaving the web UI

Changes

  • Backend: Added GET /vcs/branches endpoint to list recent branches sorted by commit date
  • Backend: Added POST /vcs/checkout endpoint to switch branches
  • Frontend: Updated session-new-view dropdown to show up to 6 recent branches
  • Frontend: Handle branch selection with checkout API and toast notifications
  • SDK: Regenerated with new types (BranchInfo, CheckoutInput, CheckoutResult)

Testing

  1. Start API server: cd packages/opencode && bun dev -- serve --port 5556
  2. Start Vite: cd packages/app && VITE_API_URL=http://127.0.0.1:5556 bun dev
  3. Open http://localhost:3001, click "New session"
  4. Click branch dropdown - should show recent branches
  5. Select a different branch - should checkout and show toast

Notes

  • The pre-existing TypeScript "type instantiation excessively deep" error in server.ts was triggered by adding more routes. This is a known issue (see TODO at line 77) and exists independently of these changes.
**Original Pull Request:** https://github.com/anomalyco/opencode/pull/7863 **State:** closed **Merged:** No --- ## Summary - Add recent git branches to the "New session" dropdown for quick branch switching - Users can now see and checkout recent branches without leaving the web UI ## Changes - **Backend**: Added `GET /vcs/branches` endpoint to list recent branches sorted by commit date - **Backend**: Added `POST /vcs/checkout` endpoint to switch branches - **Frontend**: Updated session-new-view dropdown to show up to 6 recent branches - **Frontend**: Handle branch selection with checkout API and toast notifications - **SDK**: Regenerated with new types (`BranchInfo`, `CheckoutInput`, `CheckoutResult`) ## Testing 1. Start API server: `cd packages/opencode && bun dev -- serve --port 5556` 2. Start Vite: `cd packages/app && VITE_API_URL=http://127.0.0.1:5556 bun dev` 3. Open http://localhost:3001, click "New session" 4. Click branch dropdown - should show recent branches 5. Select a different branch - should checkout and show toast ## Notes - The pre-existing TypeScript "type instantiation excessively deep" error in server.ts was triggered by adding more routes. This is a known issue (see TODO at line 77) and exists independently of these changes.
yindo added the pull-request label 2026-02-16 18:17:26 -05:00
yindo closed this issue 2026-02-16 18:17:26 -05:00
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: anomalyco/opencode#12539