بنقرة واحدة
teardown-worktree
Tear down the current git worktree and associated branch resources.
التثبيت باستخدام Codex أو Claude انسخ هذا Prompt والصقه في Codex أو Claude أو مساعد آخر ليراجع صفحة Skill ويثبّتها لك.
القائمة
Tear down the current git worktree and associated branch resources.
التثبيت باستخدام Codex أو Claude انسخ هذا Prompt والصقه في Codex أو Claude أو مساعد آخر ليراجع صفحة Skill ويثبّتها لك.
استنادا إلى تصنيف SOC المهني
Merges completed work back to main through a protected-branch pull request workflow.
Set up a new git worktree and install dependencies.
Merges completed work back to main through a protected-branch pull request workflow.
Set up a new git worktree and install dependencies.
Prepares a Python package for PyPI release by updating the version, building, and verifying the distribution.
Prepare a release by updating the version, building, and verifying the distribution.
| name | teardown-worktree |
| description | Tear down the current git worktree and associated branch resources. |
Tears down the current git worktree by removing its virtual environment, deleting the remote branch if it exists, and removing the worktree directory and local branch. Auto-detects the branch name and worktree path from the current directory.
$ARGUMENTS
Detect the current branch name by running git branch --show-current. Remember this as <branch>. Detect the current worktree path by running pwd. Remember this as <worktree-path>.
Clean up the poetry virtual environment for this worktree by running poetry env remove --all from the worktree directory. This removes the isolated virtual environment that was created for this worktree, preventing stale environments from accumulating.
Check whether the branch exists on origin with git ls-remote origin <branch>. If the output is non-empty, the branch exists — delete it with git push origin --delete <branch>. If the output is empty, the branch is already gone — skip deletion.
Clean up by running cd ../main && git worktree remove -f <worktree-path> && rm -rf <worktree-path> && git branch -D <branch> from the ../main directory. The -f flag forces removal even if the worktree has modifications. The rm -rf ensures any leftover files are fully removed. Do NOT run this from the worktree directory itself.
If this command succeeds, you will start getting errors such as Error: Path "/path/to/old/branch" does not exist. This means that the worktree directory you started in no longer exists, and all commands you continue to run will fail. This is a sign for you to stop. The script is complete.
../main. Only step 3 switches to ../main for the final removal.