Skip to content

feat: git worktree support — create, list, switch, remove #21

@JanSmrcka

Description

@JanSmrcka

Summary

Add worktree picker mode (w key) to differ's TUI — list, create, switch between, and remove git worktrees without leaving the app.

Motivation

Git worktrees enable parallel branch workflows (multiple working dirs, one repo). Currently requires exiting differ, running git worktree add, cd, relaunching.

Scope

  • List existing worktrees (branch + path)
  • Switch to a worktree — repoint internal Repo, reload files
  • Create new worktree + branch via text input
  • Remove worktree with double-press confirmation
  • Configurable worktree path template (worktree_dir in config)

Keybindings

Key Action
w Enter worktree picker (from file list / diff)
j/k Navigate
Enter Switch to selected worktree
n Create new worktree+branch
d Remove (double-press confirm)
esc Cancel

Technical approach

  • New git methods: ListWorktrees, AddWorktree, AddWorktreeNewBranch, RemoveWorktree
  • New UI mode modeWorktreePicker following branch picker pattern
  • Switching replaces m.repo pointer → all ops auto-target new worktree

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions