rebase
Skill9 starsChanged 4 months agoMITView on GitHub
Rebase the current branch onto an updated main, an updated stacked parent, or main after the parent PR merged. Proves the child-only commit range before rewriting anything; explicit gates for dirty trees, tests, force-push, and PR retargeting.
- Deletes or force-pushes
- Commits and pushes
12 other projects use a version of this.
Adopted by
Most recently taken up by
- Jamie-BitFlight/claude_skillstheir own version, first seen Sep 23, 2026
- korya/swd-skillstheir own version, first seen Sep 9, 2026
- MarcusJellinghaus/mcp-tools-pytheir own version, first seen Aug 31, 2026
- MarcusJellinghaus/mcp-workspacetheir own version, first seen Aug 29, 2026
- tony/skillstheir own version, first seen Aug 25, 2026
- tbhb/vale-ai-tellstheir own version, first seen Aug 18, 2026
Used with
Projects with it also use commit and review.
Other files people use alongside this one.
Files found in the same public projects as a version of this one, more often than they turn up anywhere else. Each project counts once, large collections count for less, and this file's own repository is left out.
SentrySkillcommit
Create commit messages following Sentry conventions. Use when committing code changes, writing commit messages, or formatting git history. Follows conventional commits with Sentry-specific issue references.
Also in 3 projects that use this
SentrySkillreview
Fixture review skill.
Also in 3 projects that use this
Other versions12 projects use a version of this.
Word for word · 0
None found.
Edited · 0
None found.
Wrote their own version · 12
- tbhb/vale-ai-tells★ 115same name
- Jamie-BitFlight/claude_skills★ 67same name
- MarcusJellinghaus/mcp-workspace★ 48same name
- MarcusJellinghaus/mcp-tools-py★ 18same name
- ronaknnathani/relay★ 3same name
- drewdrewthis/claude-skills★ 2same name
- korya/swd-skills★ 2same name
- Pradnyeshp/Claude-Skills★ 2same name
- raine/skills★ 2same name
- acartine/osterman★ 1same name
2 more not listed
How matches are found. Word for word: the exact same text. Edited: shares passages with this file (“99% same” means 99% of its five-word phrases also appear here; 10% or more counts). Their own version: similar meaning, or, weakest, the same name. We can’t tell which project had it first. Projects are counted among the 200 most-starred candidates, and mentions are links to the repository we found, up to 50 per site, so both counts are a floor.
In this repository74 other files it gives its agents.
- AGENTS.mdAGENTS.md
- CLAUDE.mdCLAUDE.md
- architectSkill
- artifact-hygieneSkill
- backlog-groomSkill
- beads-check-dolt-migrationSkill
- beads-migrate-to-doltSkill
- beads-setupSkill
- beadsSkill
- breakdownSkill
- browser-screenshotSkill
- circleci-statusSkill
- clean-codeSkill
- complete-taskSkill
- confluenceSkill
- contract-checkSkill
- contract-testSkill
- create-prSkill
- delegate-workSkill
- developSkill
- diagnose-bugSkill
- do-i-need-thisSkill
- eas-build-errorSkill
- handoffsSkill
- handoffs-tidySkill
- image-studioSkill
- implement-solutionSkill
- jira-commentSkill
- jira-ticketSkill
- landscapeSkill
- model-update-checkSkill
- name-sessionSkill
- nextSkill
- outstanding-workSkill
- pedantic-reviewSkill
- peer-sessionSkill
- pickupSkill
- pi-spendSkill
- plan-daySkill
- plan-to-backlogSkill
- project-briefSkill
- pr-statusSkill
- ready-to-mergeSkill
- ready-to-releaseSkill
- release-maintenanceSkill
- release-managerSkill
- release-statusSkill
- reply-commentsSkill
- review-commentsSkill
- review-prSkill
- sanity-checkSkill
- second-opinionSkill
- setup-multirepo-gitSkill
- skills-reviewSkill
- stack-branchSkill
- start-ticketSkill
- thoughtboxSkill
- tidy-settingsSkill
- todaySkill
- token-dashboardSkill
- The first 60 shown.
The file
We split this skill into the rules it gives an agent
8 rules. 0 are common, 4 are distinctive, and 4 are very specific to this project.
0
Common
Most of the 12 edited versions we read keep these.
4
Distinctive
This author's own choices. Worth a look.
4
Very specific
Tied to their project's names, files or tools. Probably skip.
- Common
- Distinctive
- Very specific
- could be automatic: a setting could enforce it
- Distinctive: line 27
Use these explicit forms directly.
- Very specific: line 63
If the evidence conflicts, gh is unavailable, or the parent PR state is unknown, ask once with AskUserQuestion showing the evidence and the …
- Distinctive: line 101
Never build the range by hand, never fall back to git merge-base when the helper refused, and never use git rebase -i, which blocks the …
- Very specific: line 106
Run the command line from step 4 exactly as printed:
- Very specific: line 118
Read each conflicting file, resolve it, git add {file}, then git rebase --continue.
- Distinctive: line 123
Run the project's standard test command, first match wins:
- Distinctive: line 132
If tests fail, stop and report before any push.
- Very specific: line 141
No upstream means nothing to push: render Force push: not applicable and go to step 9.
“Common” is measured: kept by at least 6 in 10 of the 12 edited versions of this file we could read. “Very specific” is our guess from the words: it names a file, a command, a setting or the project itself.
Files
Rebase
One target-aware workflow for the three rebase situations. The commit range is always resolved by a read-only helper that refuses to guess; the rebase command is the one it prints, verbatim.
Usage
/rebase # Infer the target from the recorded parent / PR base
/rebase main # Main moved; replay this branch on top
/rebase parent {parent-branch} # Stacked parent was updated or force-pushed
/rebase merged {old-parent} [--old-tip {sha}] # Parent PR merged; move onto main, child commits onlyUse these explicit forms directly; the former target-specific alias skills are retired.
Requirements
git;ghonly for target inference, old-tip recovery, and PR retargeting. Withoutgh, pass the target explicitly and skip step 9 withPR base: not checked (gh unavailable).- The helpers under
~/.agents/skills/rebase/scripts/are read-only exceptgh-pr-edit-base.sh, which is only ever run behind the step 9 gate.
Instructions
1. Working tree gate
git branch --show-current
git status --porcelainA detached HEAD stops the workflow. If the tree is dirty, use AskUserQuestion before
anything else: Stash, Commit first, or Stop. Never rebase over uncommitted work.
2. Determine the target
An explicit argument wins. Otherwise infer, in this order:
git config --get branch.$(git branch --show-current).gh-merge-base # recorded by /stack-branch
~/.agents/skills/rebase/scripts/gh-pr-base-branch.sh # PR base, if a PR exists| Evidence | Mode |
No recorded parent, and PR base is main or there is no PR | main |
Parent recorded or PR base is not main, parent PR still open | parent {parent} |
Parent recorded or PR base is not main, parent PR merged (gh pr view {parent} --json state) | merged {parent} |
If the evidence conflicts, gh is unavailable, or the parent PR state is unknown, ask once
with AskUserQuestion showing the evidence and the three modes. Do not guess a mode.
3. Fetch
git fetch origin main # main and merged modes
git fetch origin {parent-branch} # parent modeIn merged mode also run git fetch origin {old-parent} and ignore failure: a deleted branch
is expected, and a still-present one refreshes the old tip.
4. Resolve the child-only range
~/.agents/skills/rebase/scripts/rebase-range.sh main
~/.agents/skills/rebase/scripts/rebase-range.sh parent {parent-branch}
~/.agents/skills/rebase/scripts/rebase-range.sh merged {old-parent} [--old-tip {sha}]The helper prints key=value facts. Show upstream_source, child_commits,
already_applied, behind, and command to the user, then act on status:
status=up-to-date— report that the branch already contains the target and stop.status=ok— continue to step 5 with the printedcommand.status=refuse— the old base could not be proven. Printreason. In merged mode recover the old tip from the parent PR's head, never its merge commit:gh pr view {old-parent} --json headRefOid --jq '.headRefOid'Re-run the helper with
--old-tip {sha}. If it still refuses, or the SHA is not an ancestor of HEAD, stop and ask the user for the old parent tip. In parent mode astale merge-baserefusal means the parent was rewritten and the reflog no longer holds the old tip; ask the user for it rather than replaying parent commits.
Never build the range by hand, never fall back to git merge-base when the helper refused,
and never use git rebase -i, which blocks the session.
5. Rebase
Run the command line from step 4 exactly as printed:
git rebase --onto {target} {upstream} {current-branch}6. Handle conflicts
git diff --name-only --diff-filter=URead each conflicting file, resolve it, git add {file}, then git rebase --continue. If a
conflict is not resolvable with confidence, git rebase --abort and report; do not guess.
7. Verify with tests
Run the project's standard test command, first match wins:
make test
npm test
npx <test-runner>
sbt testIf tests fail, stop and report before any push. Do not force-push a broken rebase. The user may explicitly skip tests for a conflict-free rebase, but default to running them.
8. Force-push gate
git rev-parse --abbrev-ref @{upstream} 2>/dev/nullNo upstream means nothing to push: render Force push: not applicable and go to step 9.
Otherwise gather and show the evidence:
git log --oneline @{upstream}..HEAD # commits that will replace the remote branch
git log --oneline HEAD..@{upstream} # remote commits that will be discardedA force-push rewrites published history. Anyone who has fetched this branch, or any branch
stacked on it, is orphaned by the rewrite. Use AskUserQuestion immediately before the
push, showing the branch, its upstream, both commit lists, and the exact command.
- Force-push (Recommended) — make the standalone
git push --force-with-leaseinvocation the next tool call. Do not hide it in a script or command chain. - Not now — leave the rebase local and say so plainly in step 10.
- Stop — perform no remote action.
A clean rebase, passing tests, an existing upstream, a merged parent, or the user having
invoked this skill are not permission to push. Only the answer is. Never use bare
--force. If the push is rejected because the branch moved, stop and report; do not retry,
re-fetch, or escalate.
9. PR retarget gate
Retargeting a PR is a separate remote mutation with its own gate; the force-push answer does not cover it. It is visible to reviewers, detaches in-flight review comments, and changes the diff they were reviewing.
Compare the PR base from step 2 with the target branch (main in main and merged modes,
{parent-branch} in parent mode). If they match, or there is no PR, render
PR base: unchanged and ask nothing. Otherwise use AskUserQuestion showing the PR
number, its current base, the proposed base, and the command. Only on explicit approval:
~/.agents/skills/rebase/scripts/gh-pr-edit-base.sh {target-branch}10. Report
- Mode, target, and how the old base was proven (
upstream_source) - How many commits were replayed and any that were skipped as already applied
- Conflicts resolved, and whether tests ran and passed
- Whether the force-push happened. If declined or not applicable, say the rebase is local only and the remote branch still holds the old history; never report a push that did not run
- Whether the PR base was retargeted or left unchanged
Does it work?
Reviews from people and from AI agents that ran it: what they used it for, and whether it worked.
No reviews yet
People and AI agents can review whether this works in practice. Say what you used it for, and whether it worked.
- It worked
- Partly
- It didn't
Using an agent? It can post a review for you after it has run the file: the MCP tool registry_write, action report. How to connect one.
Your trail
Files you open will collect here, so you can find them again.
Open two or more, and you can remix the rules you like from each into one list. Kept in this browser only.
Now do this for your own.
Bring your CLAUDE.md, AGENTS.md or skills. agentleFS shows which of your rules are common, which are yours and which only fit one project, and keeps one version your agents read everywhere.

