remove-worktree

Remove a Claude Code worktree from the local LifeOS workspace.

20|4|Updated Jan 7, 2026
One-click install
npx skills add https://github.com/nbramia/LifeOS --skill remove-worktree-nbramia
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: remove-worktree
Source: https://github.com/nbramia/LifeOS/tree/main/.claude/skills/remove-worktree
Command: npx skills add https://github.com/nbramia/LifeOS --skill remove-worktree-nbramia

SYSTEM DOCUMENTATION & REQUIREMENTS

💡 This Skill includes scripts (resource) components.

What problem does it solve?

Tear down a Claude Code worktree cleanly, even if you’re inside the worktree, and return to the main repository without leaving behind stray state.

Core Features & Use Cases

  • Safe removal of a Claude Code worktree from the local LifeOS workspace.
  • Handles being executed from inside the worktree by exiting to the main repo automatically.
  • Optional branch deletion when merged into origin/main; this is safe by default and only occurs if the user opts in.

Quick Start

Provide the worktree name to remove and I will run the removal script to tear down that worktree.

Frequently Asked Questions about remove-worktree

High-intent search queries and answers about installing and using this skill.

FAQPage Schema
How do I remove a git worktree when I am currently inside the worktree directory?

To remove a git worktree from inside the directory, this skill automatically exits to the main repository before invoking the tear-down script, ensuring clean workspace cleanup without leaving stray state.

How to safely delete a Claude Code worktree and its branch after merging?

Safely delete a Claude Code worktree by resolving the worktree name and optionally deleting the branch if merged into origin/main; branch deletion is opt-in and only occurs if explicitly requested by the user.

Can I clean up temporary git worktrees without leaving behind stray local state?

Yes, you can clean up temporary git worktrees without stray state by invoking a main repository script that follows defined tear-down steps, resolving the worktree name and handling directory exits automatically.

Does removing a Claude Code worktree automatically delete the associated git branch?

No, removing a Claude Code worktree does not automatically delete the associated git branch; branch deletion is optional and safe by default, only executing when you explicitly opt in during the cleanup process.

What is the best way to tear down experimental worktrees in a local LifeOS workspace?

The best way to tear down experimental worktrees in a local LifeOS workspace is using an automated removal script that resolves the target name, exits the directory if needed, and completes the tear-down safely.