agentsclimarketplace

Rebase parent

Skill flurdy/agent-skills/skills/rebase-parent

Shared AI agent skills

Install
npx -y skills add flurdy/agent-skills --skill rebase-parent

Assembled from the repository path, not quoted from the project. Check it against their README if it does not work.

One thing to look at

  • 6 stars6 stars. Stars are a popularity signal and not a quality one, but at this level it is likely that nobody has read this closely except its author, and you would be relying on your own review.

What its author says it does

Copied from the file, not written here

Rebase the current branch onto an updated parent PR branch. Use when you have stacked PRs and the parent branch has been updated (force-pushed after its own rebase or new commits added).

SKILL.md

3.6 KB, 772 tokens by cl100k_base, as published. Nobody here has run it

Rebase onto Updated Parent Branch

Rebase the current branch onto a parent branch that has been updated.

Usage

/rebase-parent
/rebase-parent feature/parent-branch    # Explicit parent branch

Instructions

1. Identify Parent Branch

If not provided, try to determine the parent:

# Get current branch
git branch --show-current

Check PR base branch:

~/.agents/skills/rebase-parent/scripts/gh-pr-base-branch.sh

If the script is unavailable, fall back to:

gh pr view --json baseRefName --jq '.baseRefName'

If the base is main, this skill doesn't apply - use /rebase-main instead.

Ask the user to confirm the parent branch if uncertain.

2. Check Current State

# Check for uncommitted changes
git status --porcelain

# Get current branch
git branch --show-current

Stash or commit uncommitted changes before proceeding.

3. Fetch Latest Parent

git fetch origin {parent-branch}

4. Find the Fork Point

The tricky part with rebasing onto an updated parent is finding where your branch originally diverged. If the parent was rebased, the old base commits are gone.

# Get the merge base (may be outdated if parent was rebased)
git merge-base HEAD origin/{parent-branch}

# Count commits unique to your branch
git rev-list --count origin/{parent-branch}..HEAD

5. Perform the Rebase

Use --onto to rebase only your commits onto the new parent:

# Find how many commits are yours (after the original fork point)
# Then rebase those commits onto the updated parent

git rebase --onto origin/{parent-branch} $(git merge-base HEAD origin/{parent-branch}) HEAD

If that doesn't work cleanly (merge-base is stale), try:

# Interactive rebase to select only your commits
git rebase -i origin/{parent-branch}

6. Handle Conflicts

If conflicts occur:

  1. List conflicting files: git diff --name-only --diff-filter=U
  2. Resolve each conflict
  3. Stage resolved files: git add {file}
  4. Continue: git rebase --continue

If stuck, abort and ask for guidance: git rebase --abort

7. Verify With Tests

After the rebase completes (especially if conflicts were resolved), run the project's tests to confirm nothing was broken by the rebase or conflict resolution.

Try the project's standard test command in this order:

# Prefer Makefile target if present
make test

# Otherwise the project's package manager
npm test
# or
npx <test-runner>
# or
sbt test

If tests fail, stop and report to the user before pushing. Do not force-push a broken rebase.

8. Force Push

git push --force-with-lease

9. Update PR Base (if needed)

If the PR base branch needs updating:

~/.agents/skills/rebase-parent/scripts/gh-pr-edit-base.sh {parent-branch}

If the script is unavailable, fall back to:

gh pr edit --base {parent-branch}

10. Report Result

Inform the user:

  • Successfully rebased X commits onto {parent-branch}
  • Conflicts resolved (if any)
  • Force pushed to origin

Keep looking

Skills are one crate of 328,083. Ordering is by how many stacks a row turns up in, so the top of any crate is what has actually been picked rather than what has the most stars.