Skip to content

[FEATURE]: Git Branch Indicator in Prompt Input #17856

Closed as not planned
Closed as not planned

Description

@slorenzot

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

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

Willing to Pay / Sponsor This Feature

  • I am willing to financially support / sponsor development of this feature if needed.
  • This is a high-impact UX improvement that I would personally pay for.

Summary

OpenCode would benefit from a visual Git branch indicator built directly into the prompt input UI. This provides instant visibility of which branch users are working on without leaving the interface or running terminal commands.

Today, users have no visual indication of their current Git branch within the main interface, creating cognitive overhead when working across multiple branches.


🎯 Goals

  • Display the current Git branch name in the prompt input dock tray
  • Position it after the auto-accept permissions (shield) button
  • Work on both web and desktop (using the existing server /vcs endpoint)
  • Update in real-time when the branch changes
  • Hide when the project is not a Git repository
  • Support internationalization (17 languages)

🧠 Proposed UX

Visual Layout

+-------------------------------------------------------------------------+
| [Agent v] [Model v] [Variant v] [shield] [🌿 feature/branch-name]       |
|                                  |        |                             |
|                                  |        +-- NEW BRANCH INDICATOR      |
|                                  +-- Auto-accept button                 |
+-------------------------------------------------------------------------+
Image

Specifications

Property Value
Icon branch (existing in icon set)
Text style text-13-regular text-text-dimmed
Max width 120px (truncated with ellipsis)
Height 28px (h-7, matches other elements)
Tooltip "Current Git branch" (localized)

Behavior

  • Hidden when project is not a Git repository
  • Works on web AND desktop (uses server /vcs endpoint)
  • Updates in real-time when branch changes (via vcs.branch.updated event)
  • Tooltip shows "Current Git branch" on hover
  • Long branch names truncate gracefully with ellipsis

📁 Technical Approach

Uses the existing server VCS endpoint (/vcs) which already tracks the current branch and emits real-time events on branch changes. No new backend work required.

// prompt-input.tsx
const branch = createMemo(() => sync.data.vcs?.branch)

<Show when={branch()}>
  <Tooltip placement="top" gutter={8} value={language.t("prompt.branch.tooltip")}>
    <div class="flex items-center gap-1 px-2 h-7 text-13-regular text-text-dimmed">
      <Icon name="branch" size="small" />
      <span class="truncate max-w-[120px]">{branch()}</span>
    </div>
  </Tooltip>
</Show>

Files Modified

File Change
packages/app/src/components/prompt-input.tsx Add branch memo and UI
packages/app/src/i18n/*.ts Add prompt.branch.tooltip translation (17 languages)

🔗 Worktree-Aware by Design

This feature is designed to be compatible with git worktrees:

  • Branch indicator shows the current worktree's branch
  • Serves as foundation for future worktree UI enhancements

✅ Why This Is Not a Duplicate Request

Existing issues focus on git worktree infrastructure and workspace handling. This request is different because it addresses visual branch awareness in the UI - a simple UX improvement that complements those efforts.


🔗 Related Issues


🚀 Implementation Available

I have already implemented this feature and am ready to submit a PR:


💡 Key Benefits

  • ✅ Essential for AI-assisted development: When working on projects with multiple branches, it's critical to always know which branch you're on when requesting code changes from the AI. Without this visibility, users risk accidentally committing AI-generated changes to the wrong branch (e.g., main instead of feature/new-login), leading to potential production issues or messy git histories.

  • ✅ Prevents costly mistakes: A simple glance at the branch indicator before asking "refactor this component" or "fix this bug" ensures the AI's changes land in the correct context.

  • ✅ Instant Git branch visibility without running commands

  • ✅ Zero configuration required (built-in)

  • ✅ Works on both web and desktop

  • ✅ Uses existing infrastructure (no backend changes)

  • ✅ Supports 17 languages

  • ✅ Lays foundation for future worktree UI

Activity

  1. added
    discussionUsed for feature requests, proposals, ideas, etc. Open discussion
    on Mar 16, 2026
  2. added
    coreAnything pertaining to core functionality of the application (opencode server stuff)
    on Mar 16, 2026
  3. github-actions commented on Mar 16, 2026

    @github-actions
    Contributor

    This issue might be a duplicate of existing issues. Please check:

    Please review these issues and consider whether your request adds something distinct, or if it would be better addressed as a comment or contribution to one of those existing issues.

  4. removed
    discussionUsed for feature requests, proposals, ideas, etc. Open discussion
    coreAnything pertaining to core functionality of the application (opencode server stuff)
    on May 3, 2026
  5. benizzio-opencode commented on May 31, 2026

    @benizzio-opencode

    Adding another data point from using OpenCode Desktop through the opencode harness.

    Right now it is difficult to reliably tell which Git branch the active agent/session is running on without asking the agent or opening another session/window to inspect the context. That makes it too easy to lose track of whether work is happening on the intended branch or worktree.

    This is important consistency information during agent-driven work. The current session UI should persistently show the active Git branch so users can verify at a glance that changes are being made in the expected context.

  6. xingxiulaomo commented on Jul 20, 2026

    @xingxiulaomo

    👍 +1 Git sync status visualization would help avoid forgetting to push/pull. Very useful feature!

  7. github-actions commented on Sep 19, 2026

    @github-actions
    Contributor

    To stay organized issues are automatically closed after 60 days of no activity. If the issue is still relevant please open a new one.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

No labels
No labels

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions