rebase2main
将当前开发分支(通常是 dev)的提交通过 git rebase 同步到 main 分支,推送到远端, 然后切回原分支。当用户提及「同步到 main」「rebase 到 main」「更新 main」 「推送到主分支」「把 dev 合到 main」等关键词时使用此技能。 即使用户没有明确说 rebase,只要意图是把开发分支内容同步到 main,就应触发此技能。
How do I install this agent skill?
npx skills add https://github.com/ruan-cat/monorepo --skill rebase2mainIs this agent skill safe to install?
- Gen Agent Trust Hubpass
This skill provides a standard Git workflow to automate rebasing a development branch onto the main branch and pushing changes to a remote repository. It uses standard Git commands and includes basic safety checks, such as verifying a clean working tree and avoiding force pushes. No malicious patterns were detected.
- Socketpass
No alerts
- Snykpass
Risk: LOW · No issues
- Runlayerpass
1/1 file flagged
What does this agent skill do?
Rebase to Main
将当前开发分支的提交以 rebase 方式同步到 main 分支,推送远端,再切回原分支。
工作流程
-
记录当前分支名称
git branch --show-current将结果保存,后续用于切回。如果当前已在 main 分支,提示用户并终止。
-
确认工作树干净
git status如果存在未提交的变更,提示用户先处理(提交或暂存),不要继续。
-
切换到 main 分支
git checkout main -
将 dev 的提交 rebase 到 main
git rebase <原分支名>如果出现冲突,停止并告知用户需要手动解决。
-
推送 main 到远端
git push origin main使用普通 push,不使用
--force。如果 push 失败,告知用户原因。 -
切回原分支
git checkout <原分支名>
注意事项
- 不使用
--force推送,保证远端历史安全 - 如果 rebase 过程中出现冲突,立即停止并告知用户
- 执行前必须确认工作树干净(无未提交变更)
How can the creator link this skill?
Add the canonical catalog link to the repository README so users can inspect current installs and available audits. The publishing guide covers the complete discovery path.
<a href="https://skillzs.dev/skills/ruan-cat/monorepo/rebase2main">View rebase2main on skillZs</a>