Conversation
- Add auto-restore: running `wt step promote` from main worktree with no args restores the default branch (instead of erroring) - Improve help text with clearer examples showing paths and wt list-style output - Reduce output verbosity: single success line instead of progress + success + info - Fix message: "Restoring main worktree" instead of "Restoring canonical worktree state" Co-Authored-By: Claude <noreply@anthropic.com>
Co-Authored-By: Claude <noreply@anthropic.com>
Use WorkingTree.run_command() instead - it already runs commands in the worktree's path. Co-Authored-By: Claude <noreply@anthropic.com>
- test_promote_bare_repo_no_worktrees: covers empty worktrees check - test_promote_bare_repo_with_worktrees: covers is_bare() check - test_promote_detached_head_main: covers DetachedHead error for main worktree Co-Authored-By: Claude <noreply@anthropic.com>
Covers the DetachedHead error path when running `wt step promote` without arguments from a linked worktree that has a detached HEAD. Co-Authored-By: Claude <noreply@anthropic.com>
- Make default_branch() lookup lazy (only when needed for no-arg from main) - Add rollback on checkout failures to restore worktree state - Use git switch instead of git checkout for branch changes (safer) - Use worktree_only_completer() for promote branch argument - Add exit status assertions to test helpers for better diagnostics Co-Authored-By: Claude <noreply@anthropic.com>
Remove untestable rollback attempts that added complexity without being exercisable in tests. The "detach target first" ordering still protects the main worktree, and error messages provide clear context. Co-Authored-By: Claude <noreply@anthropic.com>
# Conflicts: # src/commands/step_commands.rs
Co-Authored-By: Claude <noreply@anthropic.com>
Resolves merge conflicts by keeping both: - wt step promote (from promote branch) - wt step relocate (from main branch) Updated test expectations for 8 step subcommands. Co-Authored-By: Claude <noreply@anthropic.com>
Sync generated docs and snapshots after merge. Co-Authored-By: Claude <noreply@anthropic.com>
|
Limitation: gitignored files don't move with the branch The current Why this is tricky:
This comment was written by Claude Code on behalf of @max-sixty |
Resolve conflicts in help snapshot env variables — main added WORKTRUNK_TEST_POWERSHELL_ENV. Co-Authored-By: Claude <noreply@anthropic.com>
Summary
Adds
wt step promote— an experimental command to exchange branches between the main worktree and another worktree. This addresses #738 where users want to move a branch from a worktree into the main worktree.This is useful when the main worktree has special significance (Docker Compose configs, IDE settings, heavy build artifacts anchored to project root) and hooks aren't yet set up to run on arbitrary worktrees.
Key features:
wt step promotefrom main worktree (no args) restores default branchwt listwith ⚑ indicatorExample:
Before:
After:
To restore:
wt step promote mainfrom anywhere, or justwt step promotefrom the main worktree.Why experimental
The idiomatic Worktrunk workflow doesn't use
promote— instead each worktree has a full environment. This command exists as a transitional tool while migrating to that model.Test plan
tests/integration_tests/step_promote.rsCloses #738