/oh:git-rollback --branch <branch> --target <rev> --mode reset|revert --depth <n> --dry-run --yesfrom oh
Use when needing to revert a branch to a previous state, undo mistaken commits, or roll back emergency hotfixes to a known-good version.
Ships in oh. Installing the plugin adds it to Claude Code.
What the skill costs in Claude's context, stage by stage
Name and description, though model invocation is off: only you can start it.
SKILL.md joins the conversation and stays.
None: SKILL.md is the whole skill.
交互式回滚 Git 分支到历史版本,支持 reset 和 revert 两种模式。
💡 建议: 执行本命令前,建议先运行
/clear命令清理上下文,以获得更好的分析效果。
| 选项 | 说明 |
|---|---|
--branch <branch> | 要回滚的分支;缺省时交互选择 |
--target <rev> | 目标版本(commit Hash、Tag、reflog 引用);缺省时交互选择 |
--mode reset|revert | reset:硬回滚历史;revert:生成反向提交保持历史完整 |
--depth <n> | 在交互模式下列出最近 n 个版本(默认 20) |
--dry-run | 默认开启,只预览即将执行的命令 |
--yes | 跳过所有确认直接执行,适合 CI/CD 脚本 |
git fetch --all --prunegit branch -a(本地+远端,过滤受保护分支)git log --oneline -n <depth> + git tag --merged +
git reflog -n <depth>reset 或 revert--yes)reset:git switch <branch> && git reset --hard <target>revert:git switch <branch> && git revert --no-edit <target>..HEADgit push --force-with-lease(reset)或普通
git push(revert)特点:
--force-with-lease)才能更新远程适用场景:
命令:
git switch <branch>
git reset --hard <target>
git push --force-with-lease
特点:
适用场景:
命令:
git switch <branch>
git revert --no-edit <target>..HEAD
git push
git switch -c backup/<timestamp> 恢复main / master / production 等受保护分支且开启
reset 模式,将要求额外确认--force;如需强推,请手动输入
git push --force-with-lease| 场景 | 建议调用 |
|---|---|
热修补丁上线后发现 bug,需要回到 Tag v1.2.0 | --branch release/v1 --target v1.2.0 --mode reset |
| 运维同事误推了 debug 日志提交,需要生成反向提交 | --branch main --target 3f2e7c9 --mode revert |
| 调研历史 bug,引导新人浏览分支历史 | 全交互,dry-run |
# 纯交互:列出分支 → 选分支 → 列最近 20 个版本 → 选目标 → 选择模式 → 确认
# 默认 dry-run
# 指定分支,其他交互
# --branch feature/calculator
# 指定分支与目标 commit,并用 hard-reset 一键执行(危险)
git switch main
git reset --hard 1a2b3c4d
# 需要手动确认后执行 git push --force-with-lease
# 只想生成 revert 提交(非破坏式回滚),预览即可
git log --oneline -n 20 # 查看历史
# 确认目标后
git revert --no-edit v2.0.5..HEAD
reset 会改变历史,需要强推并可能影响其他协作者,谨慎使用revert 更安全,生成新提交保留历史,但会增加一次记录What SKILL.md sets; muted values are Claude Code's defaults
haikunpx claudepluginhub zwmmm/oh-my-claudecode --plugin oh5 skills in this plugin
/git-clean-branchesUse when repository has dozens of stale or merged branches cluttering the namespace, or when onboarding onto a project with an overwhelming branch list./git-commitUse when preparing to commit changes and wanting structured, consistent commit messages following Conventional Commits specification./uniapp-uiUniApp + UnoCSS + WotUI page generator from designs. Converts screenshots or HTML/CSS to UniApp pages. Features: intelligent component mapping with priority (custom components, then WotUI, then built-in), 6 page templates (form, list, detail, tab, search, grid), auto-analyze custom components, cross-platform compatibility checks. Use for: creating UniApp pages, converting designs to code, mobile app/mini-program/H5 development. Actions: generate, create, build, convert, analyze, design. Tech: Vue3, UnoCSS, Wot Design Uni, UniApp.Other plugins' skills for the same job