Git Worktree Agent

    1

    Safely manage isolated Git worktrees for parallel development, branch integration, and risk-free repository cleanup.

    Free

    Security scanned

    Works with the AI Agents you already use

    Claude CodeClaude CodeCursorCursorCodex CLICodex CLIMuseMuseDotsDots+21 more

    Git Worktree Agent

    Example session with this skill installed

    I need to start a new feature called 'api-refactor' based on the 'main' branch, but I want to keep my current work in this directory running. Set up a worktree for it.

    • Read your context and instructions
    • Compiled the git worktree agent

    I have inspected the repository state. There are no existing worktrees at the proposed path, and the branch name is available. I have prepared a plan to isolate the api-refactor work.

    Git Worktree Plan

    ActionCommandTarget PathBranchStatus
    Inspectgit worktree listN/AN/ACOMPLETED
    Creategit worktree add ../api-refactor main -b api-refactor../api-refactorapi-refactorPENDING APPROVAL
    Verifycd ../api-refactor && git status../api-refactorapi-refactorNOT RUN
    Auditgit branch -vvN/Aapi-refactorNOT RUN

    Safety Check:

    • Path ../api-refactor does not exist: Confirmed
    • Branch api-refactor does not exist: Confirmed
    • Current directory state: Dirty (stashed changes not required due to worktree)

    Next steps

    1. Run the git worktree add command listed above to initialize the new workspace.
    2. Navigate to the new directory to begin the refactor without affecting your current process.
    3. Run git worktree list to verify both environments are tracking correctly.

    Connects securely to your tools. The creator never sees your data.

    About this skill

    Managing parallel features in a single repository often leads to messy stashes or risky branch switching that breaks build artifacts. This skill manages isolated Git worktrees, allowing for concurrent development without context switching overhead or directory collisions.

    What it does

    • Parallel workspace management isolates features or bug fixes into dedicated directories to avoid git stash cycles.
    • Safety-first cleanup prevents the accidental deletion of unmerged branches or worktrees containing dirty files.
    • Conflict detection analyzes merge-bases and compares branches to surface potential integration issues before they happen.
    • Command planning generates step-by-step Git execution plans for approval to ensure no destructive operations occur.
    • State auditing tracks worktree paths, branch associations, and pending changes across the entire local repository.

    How it works

    1. Inspection of the current repository state including git status, branch list, and existing worktree paths.
    2. Conflict checking to ensure the target branch and directory name do not collide with existing assets.
    3. Plan generation where the agent proposes specific git worktree add commands for user verification.
    4. Execution and validation of the worktree setup, checking that the environment is ready for isolated development.
    5. Integration and pruning to safely merge changes and remove directories only after verifying the work is committed.

    Frameworks & tools

    This skill works with any standard Git installation. It relies on git worktree subcommands and is compatible with terminal-based workflows, CI environments, and IDEs like VS Code or Cursor.

    Why this beats prompting it yourself

    Generic prompts often suggest risky flags like --force or forget to check for untracked files before pruning. This skill follows a strict safety protocol that verifies merge status and directory availability, preventing accidental data loss during complex parallel workflows.

    Use cases

    • Manage a hotfix in a separate directory while keeping a long-running feature build intact.
    • Run multiple versions of an application side-by-side for manual comparison or testing.
    • Isolate an automated AI agent's workspace to prevent it from overwriting your local staging area.
    • Perform safe repository audits to find and prune abandoned feature branch directories.

    Known limitations

    Requires Git 2.5 or newer. It will not execute commands without explicit shell access and user approval. It does not manage submodules unless specifically instructed.

    Requires Git 2.5+. Cannot operate without shell tool access or manual output provided by the user. Does not automatically resolve merge conflicts.

    How to use

    1. 1

      Connect your agent to the Agensi MCP

      Copy the prompt and paste it into Claude, ChatGPT, Cursor or any agent that supports MCP. It sets up the connection for you. Manual setup

    2. 2

      Sign in to Agensi

      Your agent shows a sign-in link. Sign in and click Allow.

    3. 3

      Ask for what you need

      Your agent loads this skill and uses it on your task. It always asks before any payment.

    Reviews

    No reviews yet

    Be one of the first to try it. Every listed skill goes through the trust checks below.

    Security scanned

    Checked by our 8-point scan before listing

    Fresh listing

    Recently published to Agensi

    Free forever

    No account required to browse

    Trust & safety

    Security scan

    Security scan passed 1 month ago

    • Free with an Agensi account

    Requires

    Git

    Permissions

    Terminal / Shell
    Write Files
    Listed1 month ago
    Updated13 days ago

    What's inside

    Frequently Asked Questions

    Unlike generic prompts that might use risky force flags, this agent implements a safety-first protocol that verifies branch merge status and untracked files before pruning or switching, preventing accidental data loss.

    The skill is designed for any AI agent with terminal or shell access, such as Cursor, Windsurf, or custom LLM-based CLI tools, provided they have Git 2.5 or newer installed.

    Yes, the agent can generate and execute plans to manage multiple worktrees simultaneously, allowing you to run different versions of your app side-by-side for comparison without directory collisions.

    Your purchase includes the core skill logic, a set of safety-check protocols, and documentation for integrating the agent into your specific development environment.

    The agent identifies potential merge conflicts and integration issues by analyzing merge-bases and comparing branches before you even start the worktree, saving time on complex downstream merges.

    New in DevOps & Cloud