用 Codex 或 Claude 帮你安装 复制这段 Prompt,粘贴到 Codex、Claude 或其他助手里,让它检查 Skill 页面并帮你完成安装。
直接命令不会经过审查 Prompt;运行前请先检查来源。
npx skills add https://github.com/tomevault-io/skills-registry --skill git-squash命令会保持在同一行。复制前请横向滚动并检查完整内容。
想先保存到本地?可下载 SkillsMP 当前能够提供的文件。
正在显示 SKILL.md
基于 SOC 职业分类
| name | git-squash |
| description | Squash commits non-interactively for cleaner history Use when this capability is needed. |
| metadata | {"author":"dtsong"} |
--force-with-lease push after squashing already-pushed commits--since <branch>, or --all. Reject zero, negative numbers, non-numeric input, and shell metacharacters.--since): only alphanumeric characters, hyphens, underscores, and forward slashes. Reject spaces, .., or null bytes.Combine multiple commits into fewer, cleaner commits non-interactively.
/git-squash 3 # Squash last 3 commits into 1
/git-squash --since main # Squash all commits since main
/git-squash --all # Squash all commits on branch into 1
/git-squash --preview # Show what would be squashed
# Last N commits
SQUASH_COUNT=3
# Or commits since branching from main
SQUASH_COUNT=$(git rev-list --count main..HEAD)
# Show commits that will be squashed
echo "Commits to squash:"
git log --oneline -n "$SQUASH_COUNT"
# Check for uncommitted changes
if ! git diff --quiet || ! git diff --cached --quiet; then
echo "Commit or stash your changes first."
exit 1
fi
# Ensure we have commits to squash
if [ "$SQUASH_COUNT" -lt 2 ]; then
echo "Need at least 2 commits to squash."
exit 1
fi
# Gather all commit messages
MESSAGES=$(git log --format="%s" -n "$SQUASH_COUNT" | tac)
# Generate combined message
BRANCH=$(git branch --show-current)
echo "Squashed commits from $BRANCH:"
echo ""
echo "$MESSAGES"
# Soft reset to keep changes staged
git reset --soft HEAD~"$SQUASH_COUNT"
# Create new commit with combined message
git commit -m "Combined message here"
Show the squash result and next steps.
Would squash 5 commits:
abc1234 WIP: starting feature
def5678 More work on feature
ghi9012 Fix typo
jkl3456 Actually fix the bug
mno7890 Final touches
Combined changes:
4 files changed, 123 insertions(+), 45 deletions(-)
src/components/Feature.tsx
src/hooks/useFeature.ts
src/styles/feature.css
tests/feature.test.ts
Run without --preview to execute.
Squashed 5 commits into 1:
Before:
abc1234 WIP: starting feature
def5678 More work on feature
ghi9012 Fix typo
jkl3456 Actually fix the bug
mno7890 Final touches
After:
xyz7890 Add feature component with styles and tests
Files in squashed commit:
src/components/Feature.tsx
src/hooks/useFeature.ts
src/styles/feature.css
tests/feature.test.ts
Note: History was rewritten. If already pushed:
git push --force-with-lease
Squashing all commits since main (7 commits)...
Before:
(7 commits with various WIP messages)
After:
feat: Add complete dark mode implementation
- Theme toggle component
- System theme detection
- Persistent preference storage
- Updated color palette
Ready for PR! Run:
/git-push --force-with-lease
/commit-push-pr
feat: Add user authentication
Implements login, logout, and session management.
feat: Add user authentication
- Add login form component
- Implement session management
- Add logout functionality
- Add remember me option
- Add password reset flow
feat: Add user authentication
Squashed commits:
- Add login form component
- Wire up authentication API
- Add session storage
- Fix validation bugs
- Add tests
For more control, use interactive rebase:
# Interactive rebase for last 5 commits
git rebase -i HEAD~5
# In editor, change 'pick' to 'squash' (or 's') for commits to combine
# Then edit the combined commit message
Note: Claude cannot run interactive commands, but can guide you through them.
# Create backup before squashing
git branch backup-before-squash
/git-push to clean up history/commit-push-pr for clean PRs/git-push --force-with-lease after squashing pushed commitsConverted and distributed by TomeVault — claim your Tome and manage your conversions.