git-sync-worktree

Rebase a worktree branch onto the latest trunk with safety checks.

1|Updated Jan 19, 2026
One-click install
npx skills add https://github.com/saxonthune/carta --skill git-sync-worktree
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: git-sync-worktree
Source: https://github.com/saxonthune/carta/tree/main/.claude/skills/git-sync-worktree
Command: npx skills add https://github.com/saxonthune/carta --skill git-sync-worktree

SYSTEM DOCUMENTATION & REQUIREMENTS

💡 This Skill includes scripts (resource) components.

What problem does it solve?

This Skill prevents worktrees from drifting behind the trunk by rebasing the worktree’s claude branch onto the latest trunk commits.

Core Features & Use Cases

  • Branch-safe rebase sync: Detects the current branch and derives the trunk branch name, then performs a rebase of the worktree branch onto the trunk.
  • Safety guardrails: Refuses to run if you are on the trunk branch or if there are uncommitted changes, reducing the chance of accidental history corruption.
  • Conflict guidance: Stops on rebase conflicts and explains the standard resolution flow so you can continue or abort safely.

Use case: You are actively developing in a worktree branch (for example, _claude1) and need to periodically incorporate new trunk changes without losing your work.

Quick Start

Run the sync script from within your worktree to rebase your current claude branch onto the derived trunk branch.

Frequently Asked Questions about git-sync-worktree

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

FAQPage Schema
How do I safely rebase a git worktree branch onto the trunk without losing uncommitted changes?

To safely rebase a git worktree branch, the sync process detects your current branch, verifies the working tree is clean, derives the trunk name, and executes git rebase to prevent accidental history corruption or data loss.

What happens when a worktree rebase encounters merge conflicts with the trunk branch?

When a worktree rebase encounters conflicts, the process halts and provides clear conflict resolution instructions, allowing you to manually resolve issues and safely continue or abort the rebase operation without losing progress.

Can I sync a worktree branch if I am currently checked out on the trunk?

No, you cannot sync a worktree branch while checked out on the trunk because the safety guardrails detect the current branch and refuse execution to prevent accidental history corruption on the main development line.

What is the best way to keep documentation feature branches updated with trunk changes during active development?

The best way to keep documentation feature branches updated is periodic branch synchronization, which rebases your active worktree branch onto the latest trunk commits to prevent your work from drifting behind.

Does worktree branch synchronization work with uncommitted local modifications?

No, worktree branch synchronization does not work with uncommitted modifications because the safety guardrails block execution, requiring a clean working tree before initiating the git rebase onto the trunk.

Why do I need to derive the trunk name when rebasing a feature branch in a worktree?

Deriving the trunk name is necessary to ensure the git rebase targets the correct main development line, allowing the worktree branch to accurately incorporate the latest trunk updates safely.