sync

Prune stale refs, remove unused worktrees, and delete obsolete local branches.

Updated Apr 10, 2026
One-click install
npx skills add https://github.com/erichugy/agentic.skills --skill sync-erichugy
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: sync
Source: https://github.com/erichugy/agentic.skills/tree/main/sync
Command: npx skills add https://github.com/erichugy/agentic.skills --skill sync-erichugy

SYSTEM DOCUMENTATION & REQUIREMENTS

What problem does it solve?

This skill helps developers keep a local Git repository aligned with its remotes by removing stale worktrees and obsolete local branches, ensuring a clean working state.

Core Features & Use Cases

  • Fetch and prune remote-tracking refs to reflect the true remote state.
  • Identify and remove stale local branches and their worktrees without affecting active work.
  • Pull latest changes on remaining branches and verify the final repository state.
  • Use Case: After merging a PR or finishing a feature, run sync to prune and update your local repo to origin.

Quick Start

Run a full repository cleanup: fetch and prune remotes, remove stale worktrees and branches, and pull updates on remaining branches.

Frequently Asked Questions about sync

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

FAQPage Schema
How do I prune stale git branches and worktrees after merging a PR?

To prune stale git branches and worktrees after merging a PR, you need to fetch remote updates with pruning enabled, detect obsolete local branches, and safely delete them. This process removes unused worktrees and aligns your local repository state with the remotes.

What is the best way to keep my local git repository clean and aligned with multiple remotes?

The best way to keep a local git repository clean across multiple remotes is to regularly fetch and prune remote-tracking refs, remove stale local branches, and pull updates on remaining branches. This ensures a clean working state reflecting true remote conditions.

How does git fetch prune work for removing obsolete local branches?

Git fetch prune works by querying remotes to identify and delete remote-tracking refs that no longer exist on the remote server. It then detects corresponding obsolete local branches and stale worktrees, removing them safely without affecting active work.

Can I automatically delete stale worktrees without affecting active development branches?

Yes, you can automatically delete stale worktrees without affecting active development branches. The sync mechanism identifies stale local branches and their associated worktrees, safely removing only the obsolete ones while pulling updates on the remaining active branches.

Why does my local git branch still show up after being deleted on the remote repository?

Your local git branch still shows up after remote deletion because your local repository retains stale remote-tracking refs until a prune is executed. Running a fetch with prune removes these obsolete refs and safely deletes the corresponding stale local branches.

When should I run a git worktree and branch cleanup in my development workflow?

You should run a git worktree and branch cleanup after merging a PR or finishing a feature. This repository cleanup fetches and prunes remotes, removes stale worktrees, deletes obsolete branches, and pulls updates to maintain a clean working state.