git-worktree-clean

Clean up a worktree branch by fetching fresh state from origin and hard-resetting to a target branch.

Safety Notice

This listing is imported from skills.sh public index metadata. Review upstream SKILL.md and repository scripts before running.

Copy this and send it to your AI assistant to learn

Install skill "git-worktree-clean" with this command: npx skills add ag-grid/ag-charts/ag-grid-ag-charts-git-worktree-clean

Worktree Clean

Clean up a worktree branch by fetching fresh state from origin and hard-resetting to a target branch.

Usage

/git-worktree-clean [branch]

Arguments:

  • branch (optional): Target branch to reset to. Default: origin/latest

Help

If the user provides help as an argument:

  • Explain how to use this command

  • Explain prerequisites

  • DO NOT proceed, exit immediately

Prerequisites

  • Git CLI must be available

  • Working directory should be a git worktree (not the main repository)

  • No critical uncommitted changes - warn user if dirty

Workflow

STEP 1: Verify Environment

Check if we're in a git worktree

git rev-parse --is-inside-work-tree || exit 1

Check for uncommitted changes

if [ -n "$(git status --porcelain)" ]; then echo "WARNING: Uncommitted changes detected" git status --short fi

If uncommitted changes exist, STOP and ask user for confirmation before proceeding.

STEP 2: Fetch Fresh State

Fetch latest from origin

git fetch origin

STEP 3: Hard Reset to Target

Default to origin/latest if no argument provided

TARGET_BRANCH="${ARGUMENTS:-origin/latest}"

Hard reset to target

git reset --hard "$TARGET_BRANCH"

STEP 4: Verify Clean State

Show current state

git log --oneline -1 git status

Definition of Done

  • Working tree is clean

  • HEAD matches target branch

  • User informed of reset result

Source Transparency

This detail page is rendered from real SKILL.md content. Trust labels are metadata-based hints, not a safety guarantee.

Related Skills

Related by shared tags or category signals.

General

estimate-jira

No summary provided by upstream source.

Repository SourceNeeds Review
General

sync-ag-shared

No summary provided by upstream source.

Repository SourceNeeds Review
General

batch-lint-cleanup

No summary provided by upstream source.

Repository SourceNeeds Review
General

plunker

No summary provided by upstream source.

Repository SourceNeeds Review