Skip to content

worktree: Add worktree management commands and per-worktree trunks#1163

Open
ed-irl wants to merge 3 commits into
branch-comment-forgefrom
branch-comment-commands
Open

worktree: Add worktree management commands and per-worktree trunks#1163
ed-irl wants to merge 3 commits into
branch-comment-forgefrom
branch-comment-commands

Conversation

@ed-irl

@ed-irl ed-irl commented May 14, 2026

Copy link
Copy Markdown
Collaborator

Adds a gs worktree command family and per-worktree trunk support:

  • worktree create <path>: creates a Git worktree that, by default, gets
    its own trunk branch (named after the directory, or --trunk) tracking
    the same remote trunk as the main checkout. Use -b to also create a
    tracked branch stacked on it, or --no-trunk for detached HEAD at trunk.
  • worktree list (ls): lists worktrees with their checked-out branch
    and stack.

Per-worktree trunks are stored in a new, additive worktree-trunks state
key, so older repos and binaries are unaffected. They are treated as
trunk-equivalents: each tracks the same remote ref as the canonical
trunk and acts as a graph root, so sync and restack in different
worktrees never contend on a single shared trunk checkout. repo sync
now pulls the remote canonical trunk into the worktree's local trunk.

Also adds worktree-aware filtering:

  • log short -w/--worktree: shows only stacks with a branch in the
    current worktree.
  • repo restack -w/--worktree: restacks only those stacks.

The branch graph and store gain WorktreeTrunks/TrunkFor/IsTrunk
helpers and a StacksInWorktree traversal to back these.

@ed-irl ed-irl force-pushed the branch-comment-forge branch from c8dd0d1 to 89378af Compare June 2, 2026 18:58
@ed-irl ed-irl force-pushed the branch-comment-commands branch from 75c2b68 to bed2fb1 Compare June 2, 2026 18:58
@ed-irl ed-irl force-pushed the branch-comment-forge branch from 89378af to 0f8d65a Compare June 2, 2026 20:17
@ed-irl ed-irl force-pushed the branch-comment-commands branch from bed2fb1 to 55e79ed Compare June 2, 2026 20:17
@ed-irl ed-irl force-pushed the branch-comment-forge branch from 0f8d65a to e17e522 Compare June 2, 2026 22:26
@ed-irl ed-irl force-pushed the branch-comment-commands branch from c1b7235 to 631867a Compare June 2, 2026 22:33
@ed-irl ed-irl force-pushed the branch-comment-forge branch from e17e522 to 47eb920 Compare June 8, 2026 10:18
@ed-irl ed-irl force-pushed the branch-comment-commands branch from cc6ba9a to a4057f6 Compare June 8, 2026 10:18
@ed-irl ed-irl force-pushed the branch-comment-forge branch from 47eb920 to febcc09 Compare June 12, 2026 20:07
@ed-irl ed-irl force-pushed the branch-comment-commands branch from fa75bd3 to b8b5295 Compare June 12, 2026 20:07
@ed-irl ed-irl force-pushed the branch-comment-forge branch from febcc09 to 8648c7a Compare June 13, 2026 13:39
@ed-irl ed-irl force-pushed the branch-comment-commands branch from b8b5295 to 6f87470 Compare June 13, 2026 13:39
@abhinav abhinav force-pushed the branch-comment-forge branch 3 times, most recently from c8254f9 to dabcd6f Compare June 14, 2026 04:30
@ed-irl ed-irl force-pushed the branch-comment-forge branch from dabcd6f to 1d76154 Compare June 15, 2026 09:52
@ed-irl ed-irl force-pushed the branch-comment-commands branch from 6f87470 to f6588c8 Compare June 15, 2026 09:52
@ed-irl ed-irl force-pushed the branch-comment-forge branch from 1d76154 to 5e57d40 Compare June 19, 2026 01:03
@ed-irl ed-irl changed the title branch comment: add CLI commands for managing review comments worktree: Add worktree management commands and per-worktree trunks Jun 19, 2026
@ed-irl ed-irl force-pushed the branch-comment-commands branch from 7170265 to f86efce Compare June 19, 2026 01:03
ed-irl and others added 3 commits June 23, 2026 11:43
Add `gs branch comment` subcommand group with six commands:

- list: show inline comments and staged comments,
  with `--json` for NDJSON output
- stage: stage an inline comment for batch submission
- add: post an inline comment immediately
- submit-staged: submit all staged comments as a review
- resolve: resolve or unresolve a review thread
- edit: edit a staged or forge comment

Also adds DiffBranchBytes to git.Worktree for programmatic
diff access needed by comment coordinate mapping.
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