Git Rebase Main

将已完成的任务分支合回本地 main,并关闭对应 Issue、删除任务分支、回收临时工作树。用于本地 rebase、合回主分支与收尾;不推送目标分支。仅更新待发 PR 的分支时直接 rebase。

107 stars 21 forksGit & Code Review

Install

skills CLI (Claude Code, Cursor, Codex and more)
npx skills add Dimon94/skills --skill git-rebase-main
Manual install
git clone --depth 1 https://github.com/Dimon94/skills.git /tmp/skills
mkdir -p ~/.claude/skills
cp -r /tmp/skills/skills/git-rebase-main ~/.claude/skills/git-rebase-main

Personal skills live in ~/.claude/skills. Use .claude/skills in a project folder to share a skill with your team.

From the SKILL.md

# Git Rebase Main

以线性历史把当前任务合入本地 `main`,再完成收尾。代码集成只在本地执行;Issue 与远端
源分支按 [收尾合同](references/closeout.md) 处理,目标分支不 fetch、不 push。

## 1. 绑定任务

记录仓库、源分支与 HEAD、主工作区、`main` 所在工作树、直接 Issue、验收标准,以及本次
可回收的任务工作树。按 [收尾合同](references/closeout.md) 第 1 步固定远端源 HEAD;
用 `git worktree list --porcelain` 核对路径与分支。源分支为 detached HEAD 或 Issue
对应关系不明时先补齐身份。Issue 确实不存在则记 `none`,不为收尾建票。

先读项目 AGENTS.md 的合回规则。规则写明 main 只经 PR/MR 前进时,不合入本地 `main`:报告冲突,
改用 `git-push-pr`。本地合入会让 `main` 领先远端,之后每次 PR 收尾都会在快进时 `BLOCKED`。

完成标准:每个收尾对象都有明确身份与归属;授权范围沿用收尾合同。

## 2. 提交任务改动

本 Skill 只从任务分支合入。当前分支是 `main`,或 `main` 工作树有本任务的改动时,先按
`git-worktree` 第 2 节把改动搬进任务树,之后在任务树里执行本 Skill。

任务树有改动时调用 `git-commit`,只提交已验证且属于本任务的路径。无关改动
保留原位;它们阻止 rebase 或回收时报告 `BLOCKED`,不用提交或清理它们来凑 clean。

完成标准:当前分支是任务分支,待合入改动已在任务分支提交,最小验证通过,源分支与 HEAD 已记录。

## 3. 核对 main 工作树

`main` 工作树里其他作者或其他任务的改动按 `git-worktree` 第 2 节留在原位并报告给用户;
它们阻止第 5 步快进时报告 `BLOCKED`。

完成标准:`main` 工作树不含本任务改动,`main` 的基点已固定,集成不吸收无关改动。

## 4. Rebase

执行 `git rebase main`。真实冲突调用 `resolving-merge-conflicts`;冲突处理中保持任务现场,
不自行 `--abort`。Rebase 后重跑该任务的最小验证并记录新的源分支 HEAD。

完成标准:rebase 完成,验证通过,`main` 是源分支 HEAD 的祖先。

## 5. 快进 main

- `main` 已在工作树检出:在该树执行 `git merge --ff-only <source-head>`,使用已验证的固定 SHA。
- `main` 未在任何树检出:核对旧 `main` 是源 HEAD 的祖先,再用
  `git update-ref refs/heads/main <source-head> <old-main-head>` 推进;回到主工作区检出 `main`。

快进或旧 SHA 核对失败时报告 `BLOCKED`,保留现场。

完成标准:本地 `main` 包含已验证的源 HEAD,主工作区位于 `main`。

## 6. 验证并收尾

在 `main` 上运行最小 post-merge check。通过后执行 [收尾合同](references/closeout.md)
Read the full skill on GitHub

Details

Skill name
git-rebase-main
Repository
Dimon94/skills
Path
skills/git-rebase-main/SKILL.md
Repo updated
18 November 2026

FAQ

What does the Git Rebase Main skill do?

将已完成的任务分支合回本地 main,并关闭对应 Issue、删除任务分支、回收临时工作树。用于本地 rebase、合回主分支与收尾;不推送目标分支。仅更新待发 PR 的分支时直接 rebase。

How do I install the Git Rebase Main skill?

skills CLI (Claude Code, Cursor, Codex and more): npx skills add Dimon94/skills --skill git-rebase-main. Skills go in ~/.claude/skills (personal) or .claude/skills (project), and Claude loads them automatically when a task matches the description.

Is Git Rebase Main popular?

It lives in Dimon94/skills, which has 107 GitHub stars and 21 forks.

Related skills

Maintain Verification Skill

107

Dimon94/skills

Periodic pass that keeps a project's verification skill and feature map honest: parallel source readers per feature, one live session driving every feature, at most one PR of proven corrections. Use for /maintain-verification-skill or "audit the verify skill".

Git & Code ReviewIn 2 lists21

Create Verification Skill

107

Dimon94/skills

Generate a project-local verification skill that drives your app the way a user does — any language, framework, or platform. Use for /create-verification-skill, "make a control skill for this repo", or when a project has no scripted way to prove UI/CLI/service behavior.

Software DevelopmentIn 2 lists21

How

107

Dimon94/skills

Use for "how does X work", code walkthroughs before changing something, and placement / ownership / layering questions ("where should this live", "which package owns this", "is this the right layer"). Explains subsystem architecture, runtime flow, onboarding mental models. Use why for motivation.

Software DevelopmentIn 2 lists21

Git Workflow

43

aws-samples/sample-kiro-cli-multiagent-development

Git operations, branching strategies, commit conventions, and repository management. Use when working with version control, creating branches, writing commits, or resolving merge conflicts.

Git & Code Review

Git Push PR

107

Dimon94/skills

Push a verified branch and create or update exactly one GitHub pull request. Use when the user asks to 推送远程/建 PR/更新 PR and grants push authority. Read-only without explicit authority; never approves, merges, or closes issues.

Git & Code Review21

Git Worktree

107

Dimon94/skills

为每个写任务建独立工作树,并在暂停、接手、主工作树脏了或收尾时管理这些树。用于改任何仓库文件之前、用户说“暂停”、接手上一段会话,以及清理工作树时。

Git & Code Review21

Browse the most popular Claude skills, all git & code review skills, or write your own with the skills generator.