Token导航 LogoToken导航TokenDH.com
研究检索只读github未标认证来源可访问许可证需确认审计通过

non-interactive-git-rebase非交互式 git rebase

Agent Skill

non-interactive-git-rebase 用于查找、检索和筛选相关信息,适合在 Codex、Claude、Cursor、Gemini CLI 中需要根据关键词、任务场景或来源线索快速定位候选结果时使用。可结合来源仓库、安装命令和原始 README 继续核验具体用法。安装前建议确认权限范围、维护状态,以及是否会触发联网、命令执行或文件读写。

总安装

489

周安装

21

GitHub Stars

11,018

下载量

171
CodexClaudeCursorGemini CLI

安装说明

本站只整理中文说明和来源信息,不托管安装包,也不代用户安装。

GitHub

来源数

2

许可证

unknown

最后核验

2026-05-01

来源状态

来源可访问

安装方式

通过对话安装

复制提示词发给支持本地命令或 Skills 的 AI 助手,先确认命令和权限,再让它执行。

请帮我安装这个 Agent Skill:non-interactive-git-rebase(非交互式 git rebase)
来源仓库:https://github.com/facebook/hermes
仓库路径:skills/non-interactive-git-rebase
安装命令:
npx skills add https://github.com/facebook/hermes --skill non-interactive-git-rebase
安装前请先检查当前环境是否支持对应 CLI,并向我确认将要执行的命令、安装目录、联网范围和文件读写权限;确认后再执行。

命令行安装

复制命令到本机终端执行。该命令会通过 npx skills 从第三方来源获取 Skill;本站只展示命令,不托管安装包,也不自动执行。

skills.shnpx skills
npx skills add https://github.com/facebook/hermes --skill non-interactive-git-rebase

简介

non-interactive-git-rebase 用于查找、检索和筛选相关信息。

  • 适合在 Codex、Claude、Cursor、Gemini CLI 中根据关键词或任务场景快速定位候选结果。
  • 支持 Git rebase 操作的自动化与非交互式执行。
  • 安装命令:npx skills add https://github.com/facebook/hermes --skill non-interactive-git-rebase。
  • 使用前需确认权限范围和维护状态,避免触发不必要的联网或文件操作。

SKILL.md

Non-Interactive Git Rebase

Overview

git rebase -i normally opens an editor for the todo list. By setting GIT_SEQUENCE_EDITOR to a command that replaces the todo file with a pre-prepared one, you can perform any interactive rebase operation — reorder, drop, squash, edit, amend — entirely from scripts.

CRITICAL: Always Create a Backup Branch

Before any rebase, create a backup branch:

git branch backup-before-rebase HEAD

After the rebase succeeds and verification passes, do NOT delete the backup branch automatically. Always ask the user before deleting it, unless the user explicitly requested automatic cleanup. The backup is cheap to keep and the user may discover problems later.

Core Technique

How GIT_SEQUENCE_EDITOR Works

The editor receives the todo file path as $1. Any command that overwrites that file works:

# Replace the todo with our prepared version
GIT_SEQUENCE_EDITOR="cp /tmp/prepared-todo" git rebase -i <base>

Git generates the default todo (all pick lines), then invokes cp /tmp/prepared-todo <todo-file>, which replaces it with your version. Git then executes the rewritten todo.

Preparing the Todo File

Extract the default todo without actually rebasing — copy it out, then fail the editor so git aborts:

GIT_SEQUENCE_EDITOR='cp $1 /tmp/default-todo && false' git rebase -i <base>

The false exits non-zero, so git aborts the rebase. You have the todo file, no rebase happened.

Or build it directly from git log:

git rev-list --reverse <base>..HEAD | while read hash; do
  echo "pick $hash $(git log --oneline -1 $hash | cut -d' ' -f2-)"
done > /tmp/prepared-todo

Then edit the file: reorder lines, change pick to drop/squash/edit/etc.

Using --exec for Bulk Amendments

The --exec <cmd> flag inserts an exec <cmd> line after every pick in the todo. Combined with GIT_SEQUENCE_EDITOR=: (a no-op that succeeds, leaving the default todo unchanged), this runs a command after each commit is replayed — no editor needed.

Change author email on all commits in a range:

GIT_SEQUENCE_EDITOR=: git rebase -i <base> --exec \
  'if [ "$(git log -1 --format=%ae)" != "correct@email.com" ]; then git commit --amend --no-edit --author="Name <correct@email.com>"; fi'

Change commit message pattern:

GIT_SEQUENCE_EDITOR=: git rebase -i <base> --exec \
  'git commit --amend -m "$(git log -1 --format=%B | sed s/old/new/)"'

Operations

Reorder Commits

Rearrange lines in the todo file. Example — move commit abc123 to the front:

# Build todo with abc123 first, then everything else in original order
{
  echo "pick abc123 The commit to move first"
  git rev-list --reverse <base>..HEAD | while read hash; do
    full=$(git rev-parse abc123)
    [ "$hash" != "$full" ] && echo "pick $hash $(git log --oneline -1 $hash | cut -d' ' -f2-)"
  done
} > /tmp/prepared-todo

GIT_SEQUENCE_EDITOR="cp /tmp/prepared-todo" git rebase -i <base>

Drop Commits

Remove lines from the todo, or change pick to drop.

Reword Commit Messages

NEVER use reword in the todo. The reword command opens an interactive editor for the new message, which cannot be scripted via GIT_SEQUENCE_EDITOR. Instead, use edit and amend with -m:

# Step 1: Prepare todo with 'edit' on commits to reword

# Step 2: At each stop, amend the message non-interactively:
git commit --amend -m "New subject line

New body text."

# Step 3: Continue to the next stop
git rebase --continue

Squash / Fixup

Change pick to squash or fixup. For squash, you also need GIT_SEQUENCE_EDITOR for the commit message editor that opens after squashing:

# Squash second commit into first, keep first message
# In the todo: pick aaa, fixup bbb
GIT_SEQUENCE_EDITOR="cp /tmp/prepared-todo" git rebase -i <base>

Split a Commit

This requires edit in the todo. When rebase stops, you run commands to split, then continue.

# Step 1: Prepare todo with 'edit' on the target commit
sed 's/^pick TARGET_HASH/edit TARGET_HASH/' /tmp/default-todo > /tmp/prepared-todo
GIT_SEQUENCE_EDITOR="cp /tmp/prepared-todo" git rebase -i <base>

# Step 2: Rebase stops at the target commit. Split it:
git reset HEAD~1

# Step 3: Selectively stage and commit pieces.
# If the commit has N hunks in a file and you want hunk 3:
printf 'n\nn\ny\n' | git add -p path/to/file
git commit -m "First piece: just hunk 3"

# Stage the rest
git add .
git commit -m "Second piece: remaining changes"

# Step 4: Continue the rebase
git rebase --continue

Automating hunk selection with git add -p: Each y/n in the printf corresponds to a hunk in order. This works reliably when hunks are well-separated (different regions of the file). If hunks are adjacent, git may present them as one hunk, and you may need s (split) first:

# Split first hunk, then accept/reject sub-hunks
printf 's\ny\nn\ny\n' | git add -p path/to/file

Alternative — patch-based splitting (more reliable for complex cases):

git reset HEAD~1
git diff path/to/file > /tmp/full.patch
git checkout -- path/to/file

# Apply only the lines you want for commit 1
# (manually prepare /tmp/part1.patch from full.patch)
git apply /tmp/part1.patch
git add path/to/file
git commit -m "First piece"

git apply /tmp/full.patch  # won't re-apply already-applied hunks
# Or: git checkout <original-hash> -- path/to/file
git add .
git commit -m "Second piece"

Verification

After any rebase, verify the tree content is identical to before (unless you intentionally dropped commits):

git diff backup-before-rebase HEAD --stat
# Empty output = content preserved correctly

Common Mistakes

MistakeFix
Using reword in the todoreword opens an interactive editor. Use edit + git commit --amend -m instead
Todo file has wrong hashes after prior rebaseRegenerate from git log — hashes change after every rebase
git add -p gets unexpected hunksHunks may merge if context overlaps. Use patch-based splitting instead
Deleting backup branch too earlyAlways ask the user before deleting. They may discover problems later

Quick Reference

OperationCommand
Extract todoGIT_SEQUENCE_EDITOR='cp $1 /tmp/default-todo && false' git rebase -i <base>
Reorder/dropGIT_SEQUENCE_EDITOR="cp /tmp/prepared-todo" git rebase -i <base>
Reword messageSame as above, use edit in todo, then git commit --amend -m "..." + --continue
Squash (keep msg)Same as above, use fixup in todo
Squash (edit msg)Same as above, use squash, then handle message editor
SplitSame as above, use edit, then manual split + --continue
Bulk amendGIT_SEQUENCE_EDITOR=: git rebase -i <base> --exec '<cmd>'

适合场景

01

用户想查找某类 Agent Skill 时

02

需要根据任务场景推荐可安装能力包时

03

需要对比不同来源的安装命令和来源信息时

能力概览

能力 1

按任务关键词查找相关 Skills

能力 2

展示可复制的安装命令

能力 3

保留来源站点、仓库和原始说明,方便继续核验

能力 4

展示第三方安全扫描或审计结果

安装后应在对应宿主中按原始 README 的触发条件使用;具体调用方式请以来源页面和 README 为准。

平台分布

Codex

39.61%
按下载量换算68

Claude

28.96%
按下载量换算50

Cursor

18.17%
按下载量换算31

Gemini CLI

9.49%
按下载量换算16

安全审计

Gen Agent Trust Hub

通过

Socket

通过

Snyk

通过

权限和风险

只读

该 Skill 主要提供规则、说明或参考内容,本身偏只读;真正读写文件、联网或执行命令仍取决于宿主 Agent 的任务。

安装前确认

本站仅展示第三方公开信息,不托管安装包,不提供自动安装或运行环境。安装前应自行审查源码、依赖和命令行为。当前只有一个来源,正式发布前建议补源仓库或其他目录站核验。

来源信息

继续浏览同类 Skills