worktree-rebase-merge

Commits worktree changes, rebases onto a target branch, and merges via a target worktree.

14.4k|735|Updated Nov 15, 2022
One-click install
npx skills add https://github.com/tisfeng/Easydict --skill worktree-rebase-merge
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: worktree-rebase-merge
Source: https://github.com/tisfeng/Easydict/tree/main/.agents/skills/worktree-rebase-merge
Command: npx skills add https://github.com/tisfeng/Easydict --skill worktree-rebase-merge

SYSTEM DOCUMENTATION & REQUIREMENTS

What problem does it solve?

Finishing work in a Git worktree often involves tedious manual steps: attaching detached HEADs to branches, committing changes, rebasing onto the target branch, resolving conflicts, and merging from a clean target checkout. This Skill automates that entire integration workflow safely.

Core Features & Use Cases

  • Detached HEAD Recovery: Automatically creates a Conventional Commits-style branch name from staged diffs, unstaged changes, or commit history when the checkout is detached.
  • Rebase and Merge Orchestration: Commits the source branch, rebases it onto the resolved target branch (defaulting to the remote default branch), and merges from an existing or temporary target worktree.
  • Dirty Target Protection: Detects dirty target worktrees, pauses before any rebase or merge, and never stages, stashes, or cleans the user's target checkout.
  • Use Case: You finished a feature in a detached worktree and want it committed, rebased onto main, and merged without switching your main checkout or touching other worktrees.

Quick Start

Commit my current worktree changes, rebase them onto the default branch, and merge them from a target worktree.

Frequently Asked Questions about worktree-rebase-merge

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

FAQPage Schema
How do I rebase and merge a Git worktree branch onto main?

Commit the source branch, run git rebase against the target branch from the source worktree, then merge from a worktree checked out to the target branch. This Skill automates that sequence, including creating a temporary target worktree when none exists.

How do I attach a detached HEAD to a new branch in Git?

Create a branch at the current commit with git switch -c <branch-name>, which preserves all staged and unstaged changes. This Skill derives a Conventional Commits-style name from your diffs and verifies the working tree is unchanged after attaching.

What happens if the target branch worktree has uncommitted changes?

The workflow pauses after committing the source branch and never stages, stashes, or cleans the dirty target worktree. It reports the dirty paths and waits for you to clean them and reply to continue.

Does this workflow fetch, pull, or push to the remote?

No. It only runs a read-only git ls-remote query to resolve the remote default branch. Fetching, pulling, and pushing are never performed unless you explicitly request them.

How are rebase and merge conflicts handled?

Conflicts are resolved semantically by inspecting git status, staging only resolved files, and continuing with git rebase --continue or git merge --continue. The workflow stops on product decisions or unsafe conflicts.