Skip to content

feat: add -x/--exec option to run commands in worktree after setup#238

Merged
avihut merged 1 commit intomasterfrom
feat/execute-command-option
Feb 19, 2026
Merged

feat: add -x/--exec option to run commands in worktree after setup#238
avihut merged 1 commit intomasterfrom
feat/execute-command-option

Conversation

@avihut
Copy link
Owner

@avihut avihut commented Feb 19, 2026

Summary

  • Adds -x/--exec repeatable option to checkout, checkout-branch, clone, and init commands
  • Commands run sequentially in the worktree directory after hooks complete, with full stdio inheritance (interactive apps like claude or vim work directly)
  • On failure, stops execution and propagates the error, but always writes cd_path so the shell still lands in the worktree

Usage

git worktree-checkout-branch my-feature -x claude
git worktree-clone https://github.com/org/repo -x 'mise install' -x 'npm run dev'
git worktree-init my-project -x 'echo setup complete'

Test plan

  • Unit tests pass (349 tests)
  • Integration tests pass (8 new exec-specific tests covering single/multiple commands, failure propagation, all four commands, existing worktree case)
  • mise run clippy — zero warnings
  • mise run fmt — clean
  • Man pages regenerated and verified
  • CLI docs regenerated and verified
  • SKILL.md updated with exec option documentation

🤖 Generated with Claude Code

Add a repeatable -x/--exec option to checkout, checkout-branch, clone,
and init commands. Commands run sequentially in the worktree directory
after hooks complete, with full stdio inheritance for interactive apps.
Execution stops on first failure but always writes cd_path so the shell
lands in the worktree.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
@avihut avihut added this to the v1.1.0 milestone Feb 19, 2026
@avihut avihut added the feat New feature label Feb 19, 2026
@avihut avihut self-assigned this Feb 19, 2026
@avihut avihut merged commit b4282de into master Feb 19, 2026
6 checks passed
@avihut avihut deleted the feat/execute-command-option branch February 19, 2026 06:55
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

feat New feature

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant