
Rebase2main
Rebases your current dev branch onto main, pushes main, and switches back
Rebase2main is an open-source agent skill for developer tools. It is available on Claude Code, Codex, Cursor, Gemini CLI, GitHub Copilot, Windsurf and Goose.
- Scripts
- None
- Platforms
- Claude Code, Codex, Cursor
- GitHub stars
- 5
- Last commit
- License
- MIT
- Listing updated
Similar skills
About Rebase2main
This skill walks an agent through syncing the commits of the branch you are on into main. It records the current branch, checks that the working tree has no uncommitted changes, checks out main, rebases main onto the original branch, and pushes main to origin with a normal push.
The workflow is built around safety. It stops if you are already on main, stops on a dirty working tree, halts and reports if the rebase hits conflicts, and reports the reason if the push fails. It never uses a force push, and it finishes by checking out the original branch again.
The instructions are written in Chinese and rely on git and access to an origin remote. No scripts or extra reference files are bundled with the skill.
When your agent uses it
将当前开发分支(通常是 dev)的提交通过 git rebase 同步到 main 分支,推送到远端, 然后切回原分支。当用户提及「同步到 main」「rebase 到 main」「更新 main」 「推送到主分支」「把 dev 合到 main」等关键词时使用此技能。 即使用户没有明确说 rebase,只要意图是把开发分支内容同步到 main,就应触发此技能。
From the skill's SKILL.md. Your agent reads this description to decide when to load the skill.
What it can access
From a static check of its 1 file (2 KB) on GitHub on 4 December 2026. Nothing was run. Read the files before you install a skill: it can tell your agent to run anything its tools allow.
Check another skill before you install it.
Install
This skill ships in the common-tools plugin. In Claude Code, add the marketplace and install the plugin (it may include other skills too):
/plugin marketplace add ruan-cat/monorepo
/plugin install common-tools@ruan-cat-toolsOr copy only this skill to ~/.claude/skills/rebase2main:
tmp=$(mktemp -d) &&
git clone --depth 1 https://github.com/ruan-cat/monorepo.git "$tmp" &&
mkdir -p ~/.claude/skills &&
rm -rf ~/.claude/skills/rebase2main &&
cp -R "$tmp/ai-plugins/common-tools/skills/rebase2main" ~/.claude/skills/rebase2main &&
rm -rf "$tmp"For one project only, put the folder in .claude/skills/rebase2main inside it instead.
Copy the skill folder to ~/.agents/skills/rebase2main to use it in every repository:
tmp=$(mktemp -d) &&
git clone --depth 1 https://github.com/ruan-cat/monorepo.git "$tmp" &&
mkdir -p ~/.agents/skills &&
rm -rf ~/.agents/skills/rebase2main &&
cp -R "$tmp/ai-plugins/common-tools/skills/rebase2main" ~/.agents/skills/rebase2main &&
rm -rf "$tmp"For one repository only, put the folder in .agents/skills/rebase2main inside it instead.
Copy the skill folder to ~/.cursor/skills/rebase2main to use it in every project:
tmp=$(mktemp -d) &&
git clone --depth 1 https://github.com/ruan-cat/monorepo.git "$tmp" &&
mkdir -p ~/.cursor/skills &&
rm -rf ~/.cursor/skills/rebase2main &&
cp -R "$tmp/ai-plugins/common-tools/skills/rebase2main" ~/.cursor/skills/rebase2main &&
rm -rf "$tmp"For one project only, put the folder in .cursor/skills/rebase2main inside it instead.
Run in a terminal (add --scope workspace to install it for the current workspace only):
gemini skills install https://github.com/ruan-cat/monorepo.git --path ai-plugins/common-tools/skills/rebase2mainOr copy the folder to ~/.gemini/skills/rebase2main yourself.
For GitHub Copilot in VS Code, copy the skill folder to ~/.copilot/skills/rebase2main:
tmp=$(mktemp -d) &&
git clone --depth 1 https://github.com/ruan-cat/monorepo.git "$tmp" &&
mkdir -p ~/.copilot/skills &&
rm -rf ~/.copilot/skills/rebase2main &&
cp -R "$tmp/ai-plugins/common-tools/skills/rebase2main" ~/.copilot/skills/rebase2main &&
rm -rf "$tmp"For one project only, put the folder in .github/skills/rebase2main inside it instead.
Get the folder:
git clone --depth 1 https://github.com/ruan-cat/monorepo.gitThen copy monorepo/ai-plugins/common-tools/skills/rebase2main into your agent's skills folder as rebase2main. Agents that support SKILL.md read one folder per skill.
What it does
- Branch Recording
- Saves the name of the current branch so the agent can return to it at the end.
- Clean Tree Check
- Confirms there are no uncommitted changes before any checkout or rebase runs.
- Rebase onto Main
- Checks out main and rebases it onto the original development branch.
- Safe Push
- Pushes main with a regular push and never uses force.
- Conflict Handling
- Stops and asks the user to resolve rebase conflicts manually.
Good for
- Sync my dev branch commits into main
- Rebase my feature branch onto main and push it
- Update main with the work from dev
- Push the development branch changes to the main branch
Rebase2main FAQ
When does Rebase2main trigger?
It triggers when you mention syncing to main, rebasing to main, updating main, pushing to the main branch, or merging dev into main, including cases where you do not say rebase but want the development branch content moved to main.
Does Rebase2main force push?
No. The skill uses a normal git push to origin main and explicitly avoids --force to keep remote history safe.
What happens if there are uncommitted changes?
The skill tells you to commit or stash them first and does not continue until the working tree is clean.
What happens on a rebase conflict?
The skill stops immediately and tells you to resolve the conflict manually.
How do I install Rebase2main in Claude Code?
Copy the skill folder from GitHub to ~/.claude/skills/rebase2main to use it in all your projects, or to .claude/skills/rebase2main in one project. Or install the common-tools plugin, which includes it: /plugin marketplace add ruan-cat/monorepo, then /plugin install common-tools@ruan-cat-tools.
Does Rebase2main run scripts?
No. It is instructions only, with no scripts. This comes from a static check of the files on GitHub; nothing was run. Read the files before you install it.
Which AI agents can use Rebase2main?
Claude Code, Codex, Cursor, Gemini CLI, GitHub Copilot, Windsurf and Goose. Each reads skills in the SKILL.md format from its own folder; the install steps on this page list them.
What are the best alternatives to Rebase2main?
The closest alternatives to Rebase2main are Rebase current branch, Commit push, Git merge, Check a stale branch is not undoing newer main work and Gha PR merge ref shows upstream changes.
Where this comes from
- Description: from the skill's own SKILL.md.
More from ruan-cat/monorepo

Works through an OpenSpec change's task list, implementing and checking off each task
- Open source
- 5 GitHub stars
- Developer tools

Finalizes a completed OpenSpec change, syncing its specs and moving it to the archive
- Open source
- 5 GitHub stars
- Developer tools

Generates all OpenSpec planning artifacts for a change in one pass
- Open source
- 5 GitHub stars
- Developer tools

Starts a new OpenSpec change and shows its first artifact template for review
- Open source
- 5 GitHub stars
- Developer tools

Checks and normalizes package.json, tsup and tsconfig setup for monorepo Node packages
- Open source
- 5 GitHub stars
- Developer tools

Turns incident reports and repeated failures into durable, verifiable agent skill rules
- Open source
- 5 GitHub stars
- Developer tools





