rebase-origin-main
Rebase the current feature branch onto the latest origin/master, triage conflicts by severity, then force-with-lease push with an explicit refspec.
Skill by asura1234
Install
Works with Claude Code, Claude apps, Codex, Cursor, Gemini CLI, GitHub Copilot, VS Code, OpenCode, Goose, Windsurf. Read the repository before you give any tool access to your data.
npx agentmarket install skill/asura1234-rebase-origin-main
Asks which of your tools to add it to (Claude Code, Codex, Cursor, VS Code, Windsurf, Gemini CLI, Claude Desktop) and shows the change first. See https://agentmart.dev/cli.
Get the weekly diff
The weekly diff: one email a week with new agent tools, notable updates and grade changes, plus security alerts for tools you follow. Double opt-in, one-click unsubscribe.
About
Use cases: agent-building
Reviews
Write a reviewNo reviews yet. Installed it? Reviews come from verified installers only. How reviews work
Permissions
What this skill can do and what it asks for, from its SKILL.md. Checked Oct 25, 2026.
- Tools
- No tools found
- Secrets
- None asked for
- Install scripts
- None found
Network hosts it talks to 1
codeload.github.com· found in install command
Files it touches
~/.claude/skills/rebase-origin-main
What's inside
- Skill name
rebase-origin-main- Description
- Rebase the current feature branch onto the latest origin/master, triage conflicts by severity, then force-with-lease push with an explicit refspec. Use when the user asks to "rebase", "sync master", "update to the latest master", "rebase onto origin/master", or "resolve conflicts and push". Agent-agnostic (claude / cursor / codex); pure git plus cargo for Cargo.lock.
- License
- Apache-2.0
- Instructions
- 160 lines in SKILL.md · view on GitHub
Files (1)
- SKILL.md
SKILL.md (first lines)
Resolve `SKILL_DIR` to the directory containing this loaded SKILL.md; keep the working directory in the target repository.
# Rebase onto origin/master
Rebase the current branch onto the latest `origin/master`, resolve conflicts, then force push.
Pure git; runnable by any AI agent.
```
-- Guard: refuse detached HEAD and protected branches (main / master)
-- Same guard as `commit-and-push`: these are the protected branches in Bus.
-- Remote: always `origin` (the Bus fork). Never fetch from, rebase onto, or push to `upstream`.
-- Rules
- Auto-resolve minor conflicts (imports, formatting, non-overlapping regions, docs/comments)
- Ask developer for major conflicts (same function modified both sides, signature changes,
logic conflicts, delete-vs-modify)
- Shared infra always takes the origin/master version on conflict; never merge it by hand:
`Cargo.lock`
The only regeneration allowed is cargo re-adding the entries this branch's own Cargo.toml
still needs on top of origin/master's lockfile (see RESOLVE CONFLICTS); no `cargo update`.
The cost is explicit: this drops this branch's own lockfile-only bumps. So every hit must be
recorded in `dropped_shared_infra` and listed one by one in the final output, so the developer
knows whether to redo it -- dropping is fine, dropping silently is not.
========== VALIDATE ==========
rebase_root = the single existing path from
`git rev-parse --git-path rebase-merge` / `git rev-parse --git-path rebase-apply`
IF rebase_root exists:
branch = strip `refs/heads/` from `<rebase_root>/head-name`
IF branch empty
ERROR "A rebase is in progress, but it has no named branch (rebase on a detached HEAD). Finish it manually."
-- The resume path never gets a chance to record the old HEAD before the rebase, so read the
-- orig-head the rebase itself stored. PUSH's divergence check needs it; without it there is no way
-- to separate "my own commits before rewriting" from "commits someone else pushed".
-- orig-head is a plain file holding one sha, not a ref: read its contents directly; `git rev-parse` cannot resolve it.
pre_rebase_head = contents of `<rebase_root>/orig-head` (one 40-char sha)
IF that file is missing or its contents are not a valid commit (verify with `git cat-file -e <sha>^{commit}`)
ERROR "Cannot get the pre-rebase HEAD (<rebase_root>/orig-head missing or corrupt). Finish manually, then rerun."
Do not fetch and do not start a second rebase.
ELSE:
branch = `git branch --show-current`
IF branch empty
ERROR "Rebase is not allowed on a detached HEAD. Switch to a named feature branch first."
-- The protected-branch guard applies equally to both entry paths. The resume path also ends in the
-- final force push; checking only inside ELSE would let "a rebase paused on master" bypass the guard
-- and rewrite a protected branch directly.
IF branch IN {main, master}
ERROR "Rebasing or rewriting history is not allowed on main/master."
IF rebase_root exists:
Continue at `RESOLVE CONFLICTS` using the existing paused index/worktree.
========== FETCH & REBASE ==========
`git fetch origin`
Assert `origin/master` resolves.
IF `git rev-list --count origin/master..HEAD` == 0
Print "The current branch has no commits of its own relative to origin/master."
-- Still continue: the branch may just be behind master, and the rebase is a fast-forward.
-- Must be recorded before the rebase; PUSH's divergence check uses it to exclude "my own commits before rewriting".
-- Do not switch PUSH to reading ORIG_HEAD: it is a global single slot, and any merge/reset/pull
-- in between overwrites it.
pre_rebase_head = `git rev-parse HEAD`
`git rebase origin/master`
IF no conflicts → skip to PUSH
========== RESOLVE CONFLICTS ==========
dropped_shared_infra = []
FOR EACH conflicted file (`git diff --name-only --diff-filter=U`)
Read the file to understand both sides
IF file is `Cargo.lock`
-- During a rebase ours/theirs are reversed: --ours = origin/master (the base being replayed onto),
-- --theirs = your own commit being replayed. So "take the origin/master version" is --ours.
-- Do not hand-edit it.
`git checkout --ours -- Cargo.lock`
-- If this branch's Cargo.toml adds or changes dependencies, origin/master's lockfile lacks them.
-- `cargo metadata` resolves only what is missing and writes it back, without upgrading
-- anything already locked. Never run `cargo update` here.
`cargo metadata --format-version 1 > /dev/null`
`git add Cargo.lock`
append Cargo.lock to dropped_shared_infra
ELSE IF minor conflict (import order, whitespace, formatting, non-overlapping edits, docs/comments)
Resolve automatically
`git add <file>`
ELSE (same function/method modified by both sides, signature changes, logic conflicts,
delete-vs-modify, uncertain)
Show conflict content to developer
AskUserQuestion — how to resolve?
Apply developer's choice
`git add <file>`
`git rebase --continue`
REPEAT until rebase completes
-- After taking origin/master's shared infra, this branch's commit may become entirely empty. git drops it
-- by default (a commit that only bumped Cargo.lock, once taken as origin/master, no longer appears in log
-- after the rebase completes).
-- If git instead stops and asks for confirmation, use `git rebase --skip`; do not create an empty commit.
========== PUSH ==========
IF `origin/<branch>` does not exist
-- The branch was never pushed; there is nothing on the remote to erase, so no force and no divergence check.
`git push -u origin <branch>:<branch>`
Skip the rest of this section.
remote_tip = `git rev-parse origin/<branch>`
-- ⚠️ Do not use `git rev-list --count HEAD..origin/<branch>` to detect divergence. A rebase always rewritesFrom asura1234/bus, Apache-2.0.
More from asura1234/bus
- 0.592score
pr
asura1234
Feature-branch PR workflow.
SkillAFreshness: A★ 1Claude Code +9 - 0.592score
review-pr
asura1234
Iterative code review in which the reviewer proves suspicions in the correctness / security / bug dimensions by writing tests that run red or, preferably for…
SkillAFreshness: A★ 1Claude Code +9 - 0.592score
review-plan
asura1234
Iteratively and read-only review a plan file that follows the project plan template.
SkillAFreshness: A★ 1Claude Code +9 - 0.592score
split-pr
asura1234
Split a multi-purpose Bus branch into single-purpose branches from an explicit base, as parallel PRs, a stacked PR train, or a mix of both, with dependencies…
SkillAFreshness: A★ 1Claude Code +9 - 0.592score
address-review-comments
asura1234
Author-side adjudication and handling of plan/PR review comments, including fixed whole-file chunks with the same --scope as review-pr.
SkillAFreshness: A★ 1Claude Code +9 - 0.592score
e2e-test
asura1234
Use to test the Bus TUI end to end like a manual QA tester, against a QA test doc (default tests/e2e-tui/app.md, optionally only some case IDs).
SkillAFreshness: A★ 1Claude Code +9 - 0.592score
delete-dead-code
asura1234
Clean up entropy on two tracks.
SkillAFreshness: A★ 1Claude Code +9 - 0.592score
gate-and-fix
asura1234
Use on a feature branch that is getting ready to commit, when lint, unit, integration, coverage, and diff gates must pass and failures must be remediated from…
SkillAFreshness: A★ 1Claude Code +9 - 0.588score
merge-pr
asura1234
Watch an open PR's two signals until it can merge — CI conclusions and review comments.
SkillAFreshness: A★ 1Claude Code +9 - 0.587score
worktree-new
asura1234
Create a new git worktree (an isolated working copy of the repo) and provision it so it can build, test and commit out of the box — create it from a freshly…
SkillAFreshness: A★ 1Claude Code +9 - 0.587score
commit-and-push
asura1234
Analyze the current git changes, split them into commits following "each commit does exactly one thing" with lowercase Conventional Commit subjects, and push…
SkillAFreshness: A★ 1Claude Code +9 - 0.583score
worktree-close
asura1234
Remove a git worktree that is no longer needed.
SkillAFreshness: A★ 1Claude Code +9
Signals
- Stars
- 1
- Forks
- 0
- Open issues
- 0
- Last commit (this folder)
- Oct 6, 2026 (24 days ago)
From GitHub (fetched Oct 24, 2026).
Details
- License
- Apache-2.0
- Repository
- github.com/asura1234/bus
- First seen
- Oct 24, 2026
- Last checked
- Oct 24, 2026
- Source
- GitHubgithub-graphql
More from asura1234
- 0.592score
gate-and-fix
asura1234
Use on a feature branch that is getting ready to commit, when lint, unit, integration, coverage, and diff gates must pass and failures must be remediated from…
SkillAFreshness: A★ 1Claude Code +9 - 0.592score
pr
asura1234
Feature-branch PR workflow.
SkillAFreshness: A★ 1Claude Code +9 - 0.592score
address-review-comments
asura1234
Author-side adjudication and handling of plan/PR review comments, including fixed whole-file chunks with the same --scope as review-pr.
SkillAFreshness: A★ 1Claude Code +9 - 0.592score
e2e-test
asura1234
Use to test the Bus TUI end to end like a manual QA tester, against a QA test doc (default tests/e2e-tui/app.md, optionally only some case IDs).
SkillAFreshness: A★ 1Claude Code +9 - 0.592score
delete-dead-code
asura1234
Clean up entropy on two tracks.
SkillAFreshness: A★ 1Claude Code +9 - 0.592score
review-plan
asura1234
Iteratively and read-only review a plan file that follows the project plan template.
SkillAFreshness: A★ 1Claude Code +9
Cite this page
rebase-origin-main skill. Agent Mart. https://agentmart.dev/skills/asura1234-rebase-origin-main (last updated 2026-10-24)