Deterministic Git Worktree Squash & Teardown Pro

    by Julia

    1

    Safely squash linked worktree changes to main, exclude build artifacts, update SemVer, and teardown worktree cleanly.

    $1.99

    Secure checkout via Stripe

    Money-back guarantee

    Converts to your local currency at checkout

    Security scanned

    Works with the AI Agents you already use

    Deterministic Git Worktree Squash & Teardown Pro

    Example session with this skill installed

    /sgit-merge-worktree clean artifacts and squash feature-auth worktree into main

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

    Inspecting worktree repository state...
    Source: D:/Workspace/project/.worktrees/feature-auth (branch: feature-auth)
    Target Branch: main (HEAD: 8f9b2c1)

    Artifact Cleanup: 14 temporary build files removed from .local/build (freed 42 MB)
    Version Plan: 1.2.0 -> 1.2.1 (patch increment on main)

    Proposed Squash Commit
    feat(auth): complete OAuth2 implementation and token refresh

    Features

    • Add OAuth2 provider support
    • Implement token refresh rotation

    Bug Fixes

    • Fix session expiration race condition

    Confirmed by user -> Applying squash merge and committing to main...
    Commit successful: 3d5e7f2 (HEAD -> main)
    Removing source worktree safely...
    Worktree removed cleanly. Task directory cleaned up.

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

    About this skill

    Overview

    A deterministic, artifact-excluding Git worktree squash, SemVer synchronization, and teardown skill designed for modern AI coding agents (Claude Code, Cursor, Codex, Windsurf, Antigravity, OpenClaw, Roo Code).

    Why sgit-merge-worktree?

    Multi-agent and branch workflows frequently spin up separate Git worktrees. However, integrating a worktree back into the main branch often results in serious problems:

    • Artifact Pollution: Worktrees accumulate local build outputs, compilation artifacts (.local/, build/, dist/, tmp/), caches, and debug logs. Standard git merge --squash pulls these dirty files directly into the main repository.
    • Worktree Leaks & Drift: Agents abandon unremoved worktree folders across disk, leaving locked repositories or stale tracking branches.
    • Accidental Data Loss: Force-deleting worktrees without creating a safety snapshot of uncommitted experimentation.
    • Version Drift: The version on the main branch is not incremented, or requires multiple corrective commits after the merge.

    Key Capabilities

    1. Pre-Merge Artifact Cleanup (merge_artifacts.py): Purges unneeded temporary build directories while protecting game saves, signing keys, and source assets.
    2. Strict Artifact Exclusion: Guarantees temporary files and caches NEVER enter the Git index, safety stash, squash diff, or final commit.
    3. Safety Snapshot Stash: Captures an identifiable safety stash of uncommitted work before performing any mutations.
    4. Conventional Commits & Automated SemVer Bump: Calculates a 3-segment Semantic Versioning patch bump against the target main branch and bundles the update into the single squash commit.
    5. Clean Worktree Removal & Teardown: Performs pre-removal sanity checks (check-cleanup), removes the linked worktree (git worktree remove) without dangerous force flags, and cleans up task state directories.
    6. Zero External Dependencies: Pure Python 3.10+ standard library.

    Supported Platforms

    • Claude Code (~/.claude/skills/sgit-merge-worktree/)
    • Cursor / Windsurf / Codex (~/.agents/skills/sgit-merge-worktree/)
    • Antigravity (~/.gemini/config/skills/sgit-merge-worktree/)

    Requires target branch to be clean. Does not support automatic conflict resolution. Source must be a removable linked worktree. Limited to Python 3.10+ environments.

    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 buying a skill.

    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

    Money-back guarantee

    Doesn't do what its page promises? You get your money back.

    Trust & safety

    Security scan

    Security scan passed 12 days ago

    Software
    PythonGit

    Permissions

    Terminal / Shell
    Read Files
    Write Files
    Environment Variables
    Listed12 days ago

    What's inside

    Frequently Asked Questions

    The skill automates the transition from a secondary worktree back to your main branch, handling the exclusion of local artifacts, squash-committing the history, and performing a clean filesystem teardown in one atomic operation.

    It is designed for any Python 3.10+ environment with Git installed and is compatible with AI agents capable of executing local CLI tools and managing file systems.

    The skill analyzes your commit history against Conventional Commit standards to determine if a major, minor, or patch version bump is required, automatically updating your project's version files.

    Before any destructive action like a worktree removal, the skill creates a safety stash and state-tracking JSON file to ensure you can recover your work if the merge is interrupted.

    No, this skill is specifically optimized for repository structures that utilize Git worktrees to isolate feature development; it expects a linked worktree to be present as the source.

    You receive the core logic for the worktree integration protocol, the artifact scrubbing configurations, and the state-management framework to ensure clean merges every time.

    New in Workflow Automation

    Find more skills like this on the Claude Skills Marketplace, the Codex Skills Marketplace and the Gemini Skills Marketplace, or browse Claude Skills for Workflow Automation.