claude/skills/rebase-stack/SKILL.md
Use when working with stacked diffs (branch B based on branch A, which is based on main).
npx skillsauth add tbroadley/dotfiles rebase-stackInstall this skill globally with one command. Works with Claude Code, Cursor, and Windsurf.
3 of 9 scanners reported clean
Some scanners were skipped, did not run, or reported a non-clean status. Review each row below.
Use this skill when working with stacked diffs (Branch B based on Branch A, which is based on main).
This skill covers two scenarios:
Use when Branch A (the base) has new commits and Branch B needs to be updated to include them.
# You should be on Branch B
git branch --show-current
# Fetch latest
git fetch origin
# See Branch A's recent commits
git log --oneline origin/branch-a -10
Find where Branch B originally diverged from Branch A:
# This shows the commit where Branch B was created from Branch A
git merge-base HEAD origin/branch-a
The --onto flag lets you transplant Branch B's unique commits onto the updated Branch A:
# Syntax: git rebase --onto <new-base> <old-base> <branch>
git rebase --onto origin/branch-a $(git merge-base HEAD origin/branch-a) HEAD
Or if you know the old base commit:
git rebase --onto origin/branch-a <old-base-commit> HEAD
If Branch A's changes conflict with Branch B's changes:
git add <files>git rebase --continuegit push --force-with-lease origin branch-b
# On branch-b, which was based on branch-a at commit abc123
# branch-a now has new commits
$ git fetch origin
$ git rebase --onto origin/branch-a abc123 HEAD
Successfully rebased and updated refs/heads/branch-b.
$ git push --force-with-lease origin branch-b
If Branch B hasn't diverged much and you're okay with a linear history:
git rebase origin/branch-a
This works well when Branch A only added commits (no force-pushes or rebases).
Use when Branch A has been merged to main, and Branch B needs to be rebased onto main (removing the now-redundant Branch A commits).
git log shows commits from Branch A in Branch B's history# Check current branch status
git status
# See how the branch relates to main
git log --oneline --graph HEAD~20..HEAD
# Check if the PR is in a conflicting state
gh pr view --json mergeable,mergeStateStatus
If you see "mergeStateStatus": "DIRTY" or "mergeable": "CONFLICTING", proceed.
git fetch origin main
# Start rebase onto main
git rebase origin/main
When git tries to apply commits that are already in main (via the merged base branch), you'll see conflicts. These commits should be skipped, not resolved.
Signs a commit should be skipped:
For each conflicting commit that was already merged:
git rebase --skip
Git will automatically drop some commits with messages like:
dropping abc123 Some commit message -- patch contents already upstream
This is expected and correct.
If you encounter a conflict in code that is genuinely new to this branch:
git add <files>git rebase --continuegit push --force-with-lease origin <branch-name>
gh pr view --json mergeable,mergeStateStatus
gh pr checks
The PR should now show:
"mergeable": "MERGEABLE""mergeStateStatus": "BLOCKED" (waiting for CI) or "CLEAN" (ready to merge)$ git rebase origin/main
Rebasing (1/15)
CONFLICT (content): Merge conflict in src/feature.py
error: could not apply abc123... Add feature from base branch
# This commit was part of the base branch - skip it
$ git rebase --skip
Rebasing (2/15)
dropping def456 Another base branch commit -- patch contents already upstream
Rebasing (3/15)
...
Successfully rebased and updated refs/heads/my-branch.
$ git push --force-with-lease origin my-branch
The commit's changes are already in the target branch. Skip it:
git rebase --skip
If you resolved a conflict that should have been skipped:
git rebase --abort
# Start over
git rebase origin/main # or origin/branch-a
Check if the commit exists in the target:
# Get the commit message from the conflict
git log --oneline -1 REBASE_HEAD
# Search for similar commits in main
git log --oneline origin/main | grep "<keywords from commit>"
If you don't know where Branch B originally diverged from Branch A:
# Look at the reflog to find when you created the branch
git reflog show branch-b | tail -5
# Or find common ancestors
git merge-base branch-b origin/branch-a
git rebase --abort
git reset --hard origin/branch-b # Reset to remote state
# Try again
--force-with-lease instead of --force when pushing--onto flag is powerful for transplanting commits between branchesgit rebase -i (interactive) if you need fine-grained control over which commits to keeptools
Add words to the Wispr Flow dictionary. Use when the user wants to add a word, phrase, or snippet to Wispr Flow for voice dictation.
documentation
Upload images to a GitHub PR description or comment using a shared gist as image hosting. Use when the user wants to add plots, screenshots, or other images to a PR.
testing
Manage tasks, projects, and productivity in Todoist. View tasks, add new items, check completed work, and organize projects.
development
Read and analyze Inspect AI evaluation log files using the Python API. Extract samples, messages, events, and metrics from .eval files.