Summary
When merging a PR from a worktree branch, the merge-pr command should clean up the worktree using git gtr rm {worktree_name}.
Motivation / Purpose
When using git gtr worktrees for development, merging a PR leaves behind the worktree directory and its associated branch. The merge-pr command already has a "Clean Up Local Branch" step (Step 6), but it doesn't handle the worktree case. Adding worktree detection and cleanup will streamline the post-merge workflow.
Details
Modify .rulesync/commands/merge-pr.md Step 6 ("Clean Up Local Branch") to detect if the current environment or the merged branch is associated with a worktree, and if so, clean it up using git gtr rm.
Proposed changes to Step 6
Add worktree detection logic:
- Check if the merged branch is associated with a worktree (e.g., via
git worktree list)
- If a worktree is found for the branch, run
git gtr rm {worktree_name} to remove it
- If no worktree is associated, fall back to the existing cleanup behavior (
git checkout main && git pull --prune && git branch -d <branch-name>)
Files affected
.rulesync/commands/merge-pr.md
Additional Context
git gtr rm handles both the worktree directory removal and the associated branch deletion, so it replaces the need for separate git branch -d when dealing with worktrees.
Summary
When merging a PR from a worktree branch, the merge-pr command should clean up the worktree using
git gtr rm {worktree_name}.Motivation / Purpose
When using
git gtrworktrees for development, merging a PR leaves behind the worktree directory and its associated branch. The merge-pr command already has a "Clean Up Local Branch" step (Step 6), but it doesn't handle the worktree case. Adding worktree detection and cleanup will streamline the post-merge workflow.Details
Modify
.rulesync/commands/merge-pr.mdStep 6 ("Clean Up Local Branch") to detect if the current environment or the merged branch is associated with a worktree, and if so, clean it up usinggit gtr rm.Proposed changes to Step 6
Add worktree detection logic:
git worktree list)git gtr rm {worktree_name}to remove itgit checkout main && git pull --prune && git branch -d <branch-name>)Files affected
.rulesync/commands/merge-pr.mdAdditional Context
git gtr rmhandles both the worktree directory removal and the associated branch deletion, so it replaces the need for separategit branch -dwhen dealing with worktrees.