Skip to content

A checkout mid-rebase shows under the branch being rebased (#230) - #245

Merged
Amitgb14 merged 2 commits into
masterfrom
conch/rebasing-branch
Nov 15, 2026
Merged

Amitgb14 merged 2 commits into
masterfrom
conch/rebasing-branch

Conversation

@Amitgb14

Copy link
Copy Markdown
Owner

Fixes #230.

A checkout in the middle of a rebase has HEAD detached by git until the rebase ends, so conch gave its panes no branch: an agent working on main mid-git pull --rebase showed under the project and no branch.

What changes

  • gitx.Operation reads, with one call to git, what is left unfinished in a checkout and, for a rebase of a branch, which branch (rebase-merge or rebase-apply's head-name). A rebase of a detached HEAD (head-name is detached HEAD), a missing or empty head-name, and an am give no branch. InProgress and RebasingBranch are now this.
  • WorktreeInfo.Operation (capability worktree.operation.v1, omitempty): mid-rebase the worktree's Branch is the branch being rebased, with Detached still true. So panes, branch lists (BranchInfo.Worktree), the git tab and anything matching by branch see it. A HEAD detached on purpose keeps no branch.
  • TUI and Conch.app: the branch row says rebasing (or merging, cherry-picking…) before its conflict count; the project's worktree list says main · rebasing.
  • Found on the way, and fixed: worktree.stale called a linked worktree mid-rebase "detached" and suggested removing it (seen in the test on the old code), and branch.prune didn't count the branch being rebased as checked out. Now one mid-rebase is never suggested, worktree.cleanup refuses it without -force, and prune refuses its branch. conch worktree ls says rebasing.

Tests

  • gitx: each rebase backend (merge, -i, --apply) in a linked worktree, the main checkout, a rebased detached HEAD, head-name empty and missing, am, not a repository.
  • server: a pane in a checkout mid-rebase is on main, the worktree carries operation and the conflict, back after --abort, none on a plain detached HEAD; cleanup and prune leave a rebase alone. Both fail on the old code.
  • TUI, CLI and Swift (branchBadges, decoding with and without the field).
  • make gate and swift test green.

Not done: resolving or continuing the rebase from conch (out of scope).

🤖 Generated with Claude Code

Amitgb14 and others added 2 commits November 15, 2026 13:15
git detaches HEAD while it rebases, so the worktree list named no branch
and an agent working on main mid-rebase showed under no branch (#230).
The rebase names its branch in head-name: WorktreeInfo carries it, with
the operation in progress (worktree.operation.v1), and the TUI and
Conch.app say rebasing on the branch's row.

The same blindness let worktree.stale suggest removing a worktree
mid-rebase and branch.prune offer the branch being rebased; neither does
now.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@Amitgb14
Amitgb14 merged commit c72b5e8 into master Nov 15, 2026
6 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

An agent in a checkout mid-rebase shows under no branch

1 participant