Token导航 LogoToken导航TokenDH.com
研究检索只读github未标认证来源可访问clear审计异常

git-squash-commitsgit 挤压提交

Agent Skill

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

总安装

220

周安装

9

GitHub Stars

6

下载量

71
CodexClaudeCursorGemini CLI

安装说明

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

GitHub

来源数

3

许可证

MIT

最后核验

2026-05-01

来源状态

来源可访问

安装方式

通过对话安装

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

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

命令行安装

复制命令到本机终端执行。不同来源提供的安装方式可能略有差异;本站展示可直接复制的安装命令,安装前请核对来源页面。

skills.shnpx skills
npx skills add https://github.com/acking-you/myclaude-skills --skill git-squash-commits

简介

用于查找、检索和筛选相关信息。

  • 适合根据关键词、任务场景或来源线索快速定位候选结果。
  • 可结合来源仓库和原始 README 核验具体用法和功能细节。
  • 安装通过 npx skills add 命令从指定 GitHub 仓库获取,适用于 Codex、Claude、Cursor、Gemini CLI。
  • 建议确认权限范围、维护状态及是否触发联网、命令执行或文件读写。

SKILL.md

Git Squash Commits Skill

Overview

This skill helps you squash a range of git commits into a single commit with an automatically generated commit message that summarizes all the changes. It analyzes the commit history and file changes to create a comprehensive, well-structured commit message.

When to Use

  • Cleaning up messy commit history before merging
  • Consolidating multiple work-in-progress commits
  • Preparing commits for code review or pull request
  • Simplifying feature branch history
  • Removing unnecessary intermediate commits

Prerequisites

IMPORTANT: Before invoking this skill, you MUST manually reset your branch to the parent of the earliest commit you want to squash. The skill will verify this and prompt you if needed.

Example:

# If you want to squash commits from abc123 to xyz789
# First find the parent of abc123
git log --oneline abc123~5..abc123

# Then reset to the parent (e.g., parent_commit)
git reset --hard parent_commit

Usage

When invoking this skill, provide:

  1. Start commit ID: The earliest commit in the range (will NOT be included in current branch after squash)
  2. End commit ID: The latest commit in the range (will NOT be included in current branch after squash)

The skill will:

  1. Verify the current HEAD is at the parent of the start commit
  2. Analyze all commits between start and end (inclusive)
  3. Examine the file changes and commit messages
  4. Generate a comprehensive commit message with:

- High-level summary - Major changes grouped by category - Detailed improvements and fixes - Statistics (files changed, lines added/removed)

  1. Prompt user to run build/compilation to verify changes

- Wait for user confirmation - If build fails, help resolve errors - If build succeeds, proceed to next step

  1. Create the squash commit
  2. Verify the old commits are no longer in the branch history
  3. Save a summary record to ai_docs/git-squash-commits/ directory containing:

- Squash operation metadata (timestamp, branch, commit hashes) - The generated commit message - Statistics and list of original commits

Commit Message Structure

The generated commit message follows this structure:

<Type>: <Brief summary of the main changes>

Major changes:
- <Category 1>: <Description>
- <Category 2>: <Description>
- ...

<Specific area> improvements:
- <Detailed change 1>
- <Detailed change 2>
- ...

Other changes:
- <Miscellaneous improvements>
- ...

This squash consolidates N commits focusing on <focus areas>.

Statistics: X files changed, Y insertions(+), Z deletions(-)

Example Invocation

User request:

Help me squash commits from f2da9a6 to d2755e90

Skill execution flow:

  1. Check current HEAD position
  2. If not at correct position, prompt user: Please first reset to the parent of f2da9a6: git reset --hard <parent_commit_id> Then invoke this skill again.
  3. If at correct position, proceed with:

- List all commits to be squashed - Show statistics of changes - Analyze commit messages and file changes - Generate comprehensive commit message - Prompt user to run build/compile and wait for confirmation - If build fails, help resolve errors - If build succeeds, continue to next step - Execute git merge --squash d2755e90 - Commit with generated message - Verify old commits are removed from branch

Implementation Guidelines

Step 1: Verify Prerequisites

# Get current HEAD
git rev-parse HEAD

# Get parent of start commit
git rev-parse <start_commit>^

# Compare - they should match

Step 2: Analyze Commits

# List commits to squash (from start to end, inclusive)
git log --oneline <start_commit>..<end_commit>

# Include the end commit itself
git log --oneline <end_commit> -1

# Get commit messages for analysis
git log --format="%s" <start_commit>~1..<end_commit>

Step 3: Analyze Changes

# Get file statistics
git diff --stat <start_commit>~1..<end_commit>

# Get detailed changes for major files
git diff <start_commit>~1..<end_commit> -- <important_files>

Step 4: Generate Commit Message

Analyze the commits and changes to create a message that:

  • Identifies the main purpose (Refactor, Feature, Fix, etc.)
  • Groups changes by functional area
  • Highlights important improvements
  • Includes quantitative metrics

Step 5: Build Verification

After generating the commit message but before executing the squash, prompt the user to verify the changes build correctly:

Please run your project's build/compilation command to verify the changes:
- For Node.js: npm run build or yarn build
- For Python: python -m pytest or your test suite
- For Go: go build ./...
- For Rust: cargo build
- For Java/Maven: mvn compile
- For other projects: use your project-specific build command

Please run the build and let me know:
1. If the build succeeds, I will proceed with creating the squash commit
2. If the build fails, share the error output and I will help resolve it

Wait for user response:

  • If build succeeds: proceed to Step 6
  • If build fails: analyze the error, help fix issues, ask user to rebuild, repeat until success

Step 6: Execute Squash

# Squash merge all commits
git merge --squash <end_commit>

# Commit with generated message
git commit -m "$(cat <<'EOF'
<generated_message_here>
EOF
)"

Step 7: Verify Result

# Check new commit is created
git log --oneline -3

# Verify old commits are NOT in current branch
git log --oneline HEAD~20..HEAD | grep -E "(<start_commit_short>|<end_commit_short>)"
# Should return empty

Step 8: Save Summary to ai_docs

# Create ai_docs directory structure if not exists
mkdir -p ai_docs/git-squash-commits

# Generate summary filename with timestamp and commit hash
SUMMARY_FILE="ai_docs/git-squash-commits/$(date +%Y%m%d_%H%M%S)_$(git rev-parse --short HEAD).md"

# Write summary containing:
# - Squash operation metadata (date, commit range, new commit hash)
# - Generated commit message
# - Statistics (files changed, insertions, deletions)
# - List of original commits that were squashed
cat > "$SUMMARY_FILE" <<EOF
# Git Squash Summary

**Date**: $(date +"%Y-%m-%d %H:%M:%S")
**Branch**: $(git branch --show-current)
**New Commit**: $(git rev-parse HEAD)

## Commit Range Squashed
- Start: <start_commit>
- End: <end_commit>

## Generated Commit Message
\`\`\`
<paste the generated commit message here>
\`\`\`

## Statistics
<paste git diff --stat output>

## Original Commits
<paste git log --oneline output of squashed commits>
EOF

echo "Summary saved to: $SUMMARY_FILE"

Notes

  • The skill assumes a linear commit history between start and end commits
  • Merge commits in the range will be included in the squash
  • The generated commit message aims to be comprehensive yet concise
  • All original commits will be removed from the current branch history
  • The squash commit will have the current branch HEAD parent as its parent
  • Statistics include all accumulated changes from start to end
  • Summary records: Each squash operation creates a markdown file in ai_docs/git-squash-commits/ directory

- Filename format: YYYYMMDD_HHMMSS_<short_hash>.md (timestamp + new commit hash) - Content includes: operation metadata, generated commit message, statistics, and list of squashed commits - Records are useful for auditing and understanding the history of squash operations - The ai_docs/ directory should be added to .gitignore if you prefer not to commit these records

Error Handling

If the user hasn't reset to the correct parent commit:

  1. Calculate the correct parent: git rev-parse <start_commit>^
  2. Show current HEAD: git rev-parse HEAD
  3. Instruct user to run: git reset --hard <correct_parent>
  4. Exit and ask user to re-invoke after reset

Best Practices

  • Always verify the commit range before squashing
  • Keep the generated message focused on "what" and "why"
  • Group related changes together
  • Highlight breaking changes or important modifications
  • Include statistics for transparency
  • Always run build/compilation before creating the squash commit to catch errors early
  • Resolve all build errors before proceeding with the squash
  • Test the changes after squashing to ensure nothing broke

适合场景

01

用户想查找某类 Agent Skill 时

02

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

03

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

04

需要参考平台分布和安装热度时

能力概览

能力 1

按任务关键词查找相关 Skills

能力 2

展示可复制的安装命令

能力 3

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

能力 4

补充不同宿主或平台的使用分布数据

能力 5

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

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

平台分布

windsurf

26.62%
按下载量换算19

Codex

22.95%
按下载量换算16

github-copilot

20.02%
按下载量换算14

Claude Code

12.7%
按下载量换算9

Antigravity

8.16%
按下载量换算6

Gemini CLI

3.5%
按下载量换算2

安全审计

Gen Agent Trust Hub

未通过

Socket

通过

Snyk

通过

权限和风险

只读

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

安装前确认

本站仅展示第三方公开信息,不托管安装包,不提供自动安装或运行环境。安装前应自行审查源码、依赖和命令行为。来源安全扫描存在 warning/failed 结果,不能写成本站确认安全。

来源信息

继续浏览同类 Skills