Skip to content

Add F key to force-update branches to upstream tip - #17

Merged
AgileIndustrialComplex merged 1 commit into
essafrom
feature/force-update
Nov 22, 2026
Merged

AgileIndustrialComplex merged 1 commit into
essafrom
feature/force-update

Conversation

@AgileIndustrialComplex

Copy link
Copy Markdown
Owner

What

Adds an F key to the picker for force-updating branches to their upstream tip.

  • With nothing marked, F targets the highlighted branch. With branches marked via c, it targets all of them.
  • A confirmation screen lists the target branches (and worktree paths, or (no worktree)), warns when a target worktree is dirty, then Enter applies. Esc/Ctrl-C/q cancels without touching Git state or clearing marks.
  • Execution: one git fetch origin, then git reset --hard origin/<branch> for branches with a worktree and git branch -f <branch> origin/<branch> for plain branches. Detached worktrees are skipped; per-item failures are combined into one error.
  • README, SPEC, help overlay, and the marked-items hint document the binding.

Why

wt manages many branches across parallel worktrees; bringing a branch (or a marked batch) back to the remote tip is a common operation that otherwise means leaving the picker and running git by hand.

Verification

  • make build fmt-check vet test-race — all pass.
  • Real-git integration tests reset both a plain branch and a worktree branch to an advanced origin tip through the picker flow.
  • Unit tests cover forceUpdateWith (fetch once, worktree vs plain ref update, detached skip, fetch failure, combined errors) and the UI state machine (highlighted/marked targets, confirm/cancel, dirty warning, help text).

Note

git fetch origin runs without --prune, so a deleted remote branch could leave a stale origin/<branch> ref that F would still reset to. Can add --prune if that case matters.

Pressing F in the picker targets the highlighted branch, or every branch
marked with c, and opens a confirmation screen before running git fetch
origin followed by reset --hard (worktree branches) or branch -f (plain
branches). Detached worktrees are skipped and dirty targets are flagged.
@AgileIndustrialComplex
AgileIndustrialComplex merged commit 557dde1 into essa Nov 22, 2026
1 check passed
@AgileIndustrialComplex
AgileIndustrialComplex deleted the feature/force-update branch November 22, 2026 21:47
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.

1 participant