sd-rebase-hygiene

Plans and verifies rebases of long-lived branches with dry-run conflict detection and force-with-lease push verification.

Updated Jun 26, 2026
One-click install
npx skills add https://github.com/platypeeps/sd-ai-command-pack --skill sd-rebase-hygiene-platypeeps
Or copy as Structured Prompt for Agent▼
Please help me install this Agent Skill.
Skill: sd-rebase-hygiene
Source: https://github.com/platypeeps/sd-ai-command-pack/tree/main/contrib/sd-rebase-hygiene
Command: npx skills add https://github.com/platypeeps/sd-ai-command-pack --skill sd-rebase-hygiene-platypeeps

SYSTEM DOCUMENTATION & REQUIREMENTS

What problem does it solve? Rebasing a long-lived branch often fails in three predictable ways: rebasing onto a stale base because the fetch was skipped, hitting conflicts mid-rebase with no plan and resolving them ad hoc, and reporting "pushed" while the remote still shows the old head. This Skill enforces a ritual that prevents all three. ## Core Features & Use Cases - Fetch-first ground truth: Resolves the correct remote and base ref, verifies a clean working tree, and rebases onto the remote-tracking ref rather than a stale local branch. - Dry-run conflict discovery: Uses git merge-tree --write-tree to enumerate the conflict surface before the working tree is touched, then pre-plans every resolution with user approval. - Verified force push: Requires explicit user approval of an exact git push --force-with-lease command pinned to the observed SHA, then proves the push landed by comparing local and remote head hashes. - Use Case: Bringing a long-lived feature branch up to date with its base before a pull request, with a recovery branch cut beforehand and an abort-and-replan path for any unplanned conflict. ## Quick Start Ask the AI to rebase your long-lived feature branch onto its base branch using the rebase hygiene ritual, naming both the branch and the base explicitly.

Frequently Asked Questions about sd-rebase-hygiene

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

FAQPage Schema
How do I safely rebase a long-lived git branch?▼

Fetch the remote first, dry-run the merge with git merge-tree to find conflicts, pre-plan every resolution with approval, cut a backup branch, then rebase and push with force-with-lease. Verify the remote ref matches your local head afterward.

How to preview merge conflicts before rebasing in git?▼

Run git merge-tree --write-tree <base> HEAD (git 2.38+) to simulate the merge and list conflicts without touching the working tree. Treat it as a lower bound, since a rebase replays commits one at a time and intermediate commits can still conflict.

Why is git push --force-with-lease safer than --force?▼

force-with-lease rejects the push if the remote ref moved since you last observed it, preventing you from overwriting commits you never saw. Pin the lease to the exact observed SHA, since the bare form trusts your remote-tracking ref, which any fetch silently refreshes.

What should I do when an unexpected conflict appears mid-rebase?▼

Abort the rebase with git rebase --abort rather than pausing, since a paused rebase leaves HEAD detached partway through. Diff the conflicting commit against the base, revise the resolution plan, get approval again, and restart.

When should I not rebase a branch automatically?▼

Never rebase just because a branch looks behind; rebasing rewrites shared history and must be a deliberate, user-invoked action. Also confirm the base explicitly rather than guessing it from the branch's upstream, which points to the branch's own remote copy.