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
More from ag-grid/ag-charts
estimate-jira
Estimate complexity, effort, and risks for JIRA tickets, features, or projects. Generates structured reports with time estimates, dependencies, risk analysis, and known unknowns. Use when user asks to "estimate", "size", or "analyze complexity" of work items.
43pr-split
Split a branch into a logical sequence of stacked PRs for easier review
27batch-lint-cleanup
Analyze ESLint violations and auto-fix specific rules in isolation
23recall
Load branch context and browse project memory for session resumption
22plunker
Create and manage Plunker (plnkr.co) code examples for AG Charts and AG Grid. Use this skill whenever the user mentions plunker, plnkr, or plunk, wants to create a shareable code demo or bug reproduction, needs to fork or modify an existing plunk, or asks for a live code example they can share via URL. This includes creating repros for JIRA tickets, building demos for stakeholders, downloading plunks to inspect them, or making any interactive code example hosted on plnkr.co. Also trigger when users ask for "a shareable example", "a repro", "a demo I can send", or "a live example" — even without explicitly saying "plunker".
22sync-ag-shared
Sync ag-shared subrepo changes across ag-charts, ag-grid, and ag-studio repos
22