Repository navigation
Description
Problem / summary
(measured: owner request, 18 Nov 2026) The Git Manager's top-right toolbar (Show merge requests, Stashes, Merge…, Rebase…) should also offer New branch and a choose a branch to merge action, both using the selected branch as the source. Today these actions exist only at the bottom of the branch dropdown.
(inferred) In Git Manager the "selected branch" is the one shown in the branch dropdown. Choosing a branch there checks it out, so it is always the checked-out branch of the selected worktree. Area: apps/web.
Evidence tags: (measured) means inspected source, tests, docs or the owner request. It does not mean the app or tests were run. (inferred) is a source-derived conclusion or a proposal. (guess) is unverified.
Current behavior
(measured) Verified at be03142dcd9f14378d4357d83ad65d2cf5af513a (main). Every path:line below refers to this SHA.
The top-right toolbar
- A right-aligned row in
GitManagerPanelholds foursize="xs"ghost buttons (GitManagerPanel.tsx:1030–1111). (measured)- Show/Hide merge requests.
- Stashes (N).
- Merge…: tooltip "Merge one branch into another", opens
GitManagerMergeDialog(:1075–1092,:891–897,:1295–1306). - Rebase…: tooltip "Rebase the current branch onto another branch" (
:1093–1110,:739–750). - A disabled button keeps its reason in the tooltip and in an
sr-onlydescription, for examplemergeDisabledReasonat:977–983. (measured)
- Merge… opens the dialog with no source chosen (
selectedSourceRefstartsnull). Into defaults to the checked-out branch (GitManagerMergeDialog.tsx:152–153, :175–178). (measured)- It loads a server merge preview and offers Merge commit or Squash.
- When the server supports
merge-into(GitManagerPanel.tsx:1465), Into can be another local branch. The source list then excludes the target, so "the checked-out branch is a source for another target" (GitManagerMergeDialog.tsx:187–190, :216–220). - Merging into a branch that is not checked out records a merge commit only: no squash, and commit hooks do not run (
docs/user/workspace-ui.md:1310–1327).
The branch dropdown (what the owner wants mirrored)
- The dropdown sits in
GitManagerToolbar, top-left (GitManagerToolbar.tsx:686–704). Its trigger showscurrentBranchName(GitManagerBranchDropdown.tsx:475). (measured) - Choosing a branch row checks it out (
selectBranch→checkoutBranch,GitManagerToolbar.tsx:444–454). So the selected branch is the checked-out branch. (measured) - The dropdown footer has two actions (
GitManagerBranchDropdown.tsx:519–567). (measured)- New branch calls
createBranch. That opens the create dialog withbaseBranch = resolveBranchCreateBase(...), which returns the checked-out branch (GitManagerToolbar.tsx:456–466,branchCreateBase.ts:8–13). The docs agree: "New branch starts from the checked-out branch" (docs/user/workspace-ui.md:1186–1194). - Choose a branch to merge into switches the list to "Select a branch above". Picking a row runs
mergeIntoCurrent, which merges the picked branch into the checked-out branch right away (_tag: "merge",source: picked), with no preview dialog (GitManagerToolbar.tsx:477–491; dropdown:377, :392–398). In that action the selected (checked-out) branch is the target, not the source.
- New branch calls
- Neither action is reachable from the top-right toolbar. (measured)
Expected behavior
(measured: owner request) The top-right toolbar shows New branch and a merge action next to Merge… and Rebase…. Both use the selected branch as the source.
(inferred; proposed semantics, see Open question 1)
- New branch (toolbar): opens the same create-branch dialog as the dropdown's New branch, with From set to the selected (checked-out) branch, or HEAD when detached. Submitting creates the branch from it, exactly as today.
- Merge into… (toolbar): opens the existing merge dialog with Source preset to the selected branch. The person chooses the branch to merge it into. The dialog keeps its preview, its blocks and its merge-into rules. This is new: today no entry point starts with the source preset.
- Merge… (existing, unchanged) still covers "choose a source and merge it into the checked-out branch".
Goals and non-goals
Goals:
- (inferred) From the toolbar, a person can start a branch from the selected branch in one click, without opening the branch dropdown.
- (inferred) From the toolbar, a person can merge the selected branch into another branch, choosing only the target, and reviewing the same server preview as Merge….
- (inferred) The toolbar buttons follow the same disabled reasons as their existing counterparts.
Non-goals:
- (inferred) Removing or changing the dropdown's New branch and Choose a branch to merge actions.
- (inferred) Changing Merge…, Rebase…, merge rules (fast-forward, squash, hooks), or the server's
merge/merge-intooperations. - (inferred) A new notion of "selected branch" that is not checked out, for example a selected row in History.
Requirements and acceptance criteria
P0
- R1 — New branch in the toolbar. WHEN a person clicks New branch in the top-right toolbar, Git Manager SHALL open the create-branch dialog with From set to the selected (checked-out) branch, or HEAD when detached. It is the same dialog, base and submit path as the dropdown's New branch.
- Scenario: GIVEN branch A is checked out in the selected worktree, WHEN New branch is clicked in the toolbar, THEN the dialog's From shows A, and creating "B" creates B from A's tip (checking it out only when "Check out after creating" is on).
- R2 — Merge from the selected branch. WHEN a person clicks Merge into…, Git Manager SHALL open the merge dialog with Source preset to the selected branch and the Into picker ready for the person to choose a different local branch.
- Merge stays disabled until a target is chosen and the server preview allows it.
- The merge runs as a merge into that target (
merge-into), so the checked-out branch and working tree do not change. - Scenario: GIVEN A is checked out and B exists, WHEN the person opens Merge A into…, chooses B and confirms, THEN B gains a merge commit from A, and A and the working tree are unchanged.
- R3 — Disabled states. The new buttons SHALL be disabled with a visible reason (tooltip and
sr-onlydescription) when their existing counterparts would be:- New branch uses
branchSyncDisabledReason. - Merge from selected is disabled when the merge is blocked (
stashMergeDisabledReason), when no branch is checked out ("Check out a branch before merging."), when the server lacksmerge-intoor Git is older than 2.38, or when there is no other local branch to merge into.
- New branch uses
- R4 — Existing actions unchanged. The dropdown's New branch and Choose a branch to merge, Merge…, Rebase…, Stashes and Show merge requests behave exactly as today.
P1
- R5 — Layout and labels. The buttons match the toolbar style (
size="xs"ghost, icon plus text:PlusIcon"New branch",GitMergeIcon"Merge into…", where a long branch name is truncated and the full name is in the tooltip and accessible name). The toolbar wraps or condenses without clipping at narrow panel widths. - R6 — Docs.
docs/user/workspace-ui.md(Git Manager toolbar section around:1186and:1310) describes the two toolbar entries and their source semantics. - R7 — Reviews. UI.md and
vercel-react-best-practicesreviews are recorded in the PR.
Tests to add or update, and repository gates
-
apps/web/src/components/gitManager/GitManagerPanel.test.tsx:- The toolbar renders New branch and Merge into….
- New branch opens the create dialog with From = checked-out branch.
- Merge into… opens
GitManagerMergeDialogwith the source preset and the checked-out branch excluded from Into. - Each disabled reason from R3 shows.
-
apps/web/src/components/gitManager/merge/GitManagerMergeDialog.test.tsx: a preset source is selected on open and excluded from Into. The confirm request ismerge-intowith{ source: selected, target: chosen }. Withoutmerge-intosupport the entry is refused. -
apps/web/src/components/gitManager/GitManagerToolbar.test.tsxandtoolbar/GitManagerBranchDropdown.test.tsx: the existing New branch and merge-mode assertions stay green (R4). -
apps/web/src/components/gitManager/toolbar/branchCreateBase.test.ts: unchanged, or extended if the base resolver is shared with the toolbar. - (inferred) Optional: a desktop e2e spec
apps/desktop/e2e/specs/git-manager-toolbar-branch-actions.e2e.tscovering both buttons on a fixture repository. There is no Git Manager e2e spec yet. - Gates:
vp check,vp run typecheck, and the focused web tests. No server or contract change is expected; if one happens,cargo fmt --all --check,cargo clippy --workspace --all-targets -- -D warningsandvp run check:contractstoo. - Profiler coverage line in the delivery report. Branch names are never recorded.
Open questions
- Which direction does the toolbar merge go? The request says "choose a branch to merge that used selected branch as source".
- (a) The selected branch is the source; the person chooses the target (Merge into…).
- (b) Mirror the dropdown: choose a branch and merge it into the selected branch.
- Recommended: (a). It matches "selected branch as source", and (b) already exists as Merge… (source picker, Into defaults to the checked-out branch).
- (inferred) Trade-off: (a) uses
merge-into. That needs Git 2.38 or newer and records a merge commit only (no squash, no hooks), and a conflicting merge is blocked with a hint to check the target out.
- Preview or immediate? The dropdown's merge runs immediately with no preview; Merge… shows a preview. Recommended: reuse the Merge… dialog with its preview, because merging into another branch should be reviewed before it changes that branch.
- Default Into target? Recommended: leave Into empty until the person chooses, because guessing a target could merge into the wrong branch. Alternative: preselect the repository default branch when it is not the source.
- Where in the row? Recommended: New branch first, then Merge into…, before Merge… and Rebase…, so the branch-scoped actions sit together.
Duplicate check
(measured) I searched open and closed issues for: Git Manager toolbar, new branch, merge branch, merge into, branch dropdown, Git Manager merge, create branch from.
- No duplicate.
- Related, not duplicates: Git Manager: app crashes with React #185 after switching branch and fetching in a large repo #360 (closed, Git Manager crash after a branch switch), Worktrees: create dialog keeps the previous worktree's values #346 and [Bug]: Create Worktree ignores edited Name when branching from an occupied branch #136 (closed, Create Worktree dialog), PR, pipeline and Git Manager panels: first load shows no spinner, only a faint gray bar or plain text #377 (open, Git Manager first-load spinner).
- Open PR fix: close the open issue batch and the findings its validation showed #387 does not touch any
gitManagerfile.
Triage proposal
(inferred; agent's call) Labels: enhancement, needs-triage, size:S. Web-only: two toolbar buttons reusing the existing create-branch and merge dialogs, plus a preset-source prop on the merge dialog and tests. About 4–8 hours of work. Priority P2.
(measured) Privacy check: no usernames, local paths, hostnames, project names, branch names from screenshots, or tokens. Screenshots are not attached.
Activity
fix: close the open issue batch and the findings its validation showed