sync

Sync Git worktrees by rebasing them onto updated main and pruning stale refs.

1|Updated Mar 24, 2026
One-click install
npx skills add https://github.com/matteobortolazzo/claude-tools --skill sync-matteobortolazzo
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: sync
Source: https://github.com/matteobortolazzo/claude-tools/tree/main/ccflow/skills/sync
Command: npx skills add https://github.com/matteobortolazzo/claude-tools --skill sync-matteobortolazzo

SYSTEM DOCUMENTATION & REQUIREMENTS

What problem does it solve?

Syncs the local Git repository to ensure main is up-to-date, active worktrees are rebased onto the latest main, and merged-PR leftovers are cleaned up.

Core Features & Use Cases

  • Update main from all remotes and prune deleted branches to prevent drift.
  • Rebase every active worktree onto the latest main when possible, skipping dirty or detached worktrees.
  • Prune stale worktrees and remove local branches that correspond to gone remotes to maintain a clean repo state.

Quick Start

Run the sync task to update main, rebase worktrees, prune stale refs, and cleanup merged branches.

Frequently Asked Questions about sync

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

FAQPage Schema
How do I keep git worktrees in sync with main?

To keep git worktrees in sync, the sync task fetches and prunes remotes, checks out main, and rebases each active worktree onto the updated main branch. It skips dirty or detached worktrees to prevent data loss.

What is the best way to clean up merged PR branches and stale worktrees?

The best way to clean up merged PR leftovers is to run a sync task that prunes stale worktrees and removes local branches corresponding to gone remotes. It generates a final report of the cleanup.

Can I rebase multiple git worktrees automatically when remotes are updated?

Yes, you can automatically rebase multiple git worktrees by running the sync task. It applies to multi-worktree repositories with multiple remotes, fetching updates and rebasing active worktrees onto main.

Does git worktree rebasing work with repositories that have multiple remotes?

Git worktree rebasing works with multiple remotes by fetching and pruning all configured remotes before checking out main. It ensures coordinated updates across the entire local repository.

How do I prune obsoleted git worktrees after merging a PR?

To prune obsoleted git worktrees after a PR merge, the sync task identifies stale worktrees and removes local branches tracking gone remotes. This maintains a clean repository state.

Why does the sync task skip dirty or detached worktrees during rebasing?

The sync task skips dirty or detached worktrees during rebasing to prevent data loss and conflicts. It only rebases active worktrees that can safely be updated onto the latest main branch.