Skip to content

Add pre-remove hook for cleanup before worktree removal - #107

Merged
max-sixty merged 2 commits into
mainfrom
post-remove
Dec 8, 2025
Merged

max-sixty merged 2 commits into
mainfrom
post-remove

Conversation

@max-sixty

Copy link
Copy Markdown
Owner

Summary

  • Add pre-remove hook that runs before wt remove deletes a worktree
  • FailFast strategy: non-zero exit code aborts removal (worktree preserved)
  • Works in both sync and background modes (hooks run before spawning background)
  • Add --no-verify flag to skip hooks
  • Add wt step pre-remove for manual execution

Test plan

  • Hook executes with all template variables
  • Non-zero exit aborts removal
  • Works in background mode
  • Does not run for branch-only removal
  • --no-verify skips hooks
  • wt step pre-remove works

🤖 Generated with Claude Code

Implement pre-remove hooks that run before `wt remove` deletes a worktree.
This allows cleanup tasks, state saving, or external notifications before
removal. Key features:

- FailFast strategy: non-zero exit code aborts removal (worktree preserved)
- Runs in both sync and background modes (before spawning background)
- All standard template variables available (branch, worktree, repo, etc.)
- Does not run for branch-only removal (no worktree)
- Skip with `--no-verify` flag
- Run manually with `wt step pre-remove`

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude <[email protected]>
@max-sixty
max-sixty merged commit 22698cf into main Dec 8, 2025
@max-sixty
max-sixty deleted the post-remove branch December 8, 2025 19:18
@max-sixty

Copy link
Copy Markdown
Owner Author

closes a subset of #101

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