用 Codex 或 Claude 帮你安装 复制这段 Prompt,粘贴到 Codex、Claude 或其他助手里,让它检查 Skill 页面并帮你完成安装。
直接命令不会经过审查 Prompt;运行前请先检查来源。
npx skills add https://github.com/tools-only/X-Skills --skill rebase-interactive命令会保持在同一行。复制前请横向滚动并检查完整内容。
想先保存到本地?可下载 SkillsMP 当前能够提供的文件。
Index of Build Systems Skills
Coordination patterns for distributed dataflow systems including barriers, epochs, and distributed snapshots
Windowing, sessionization, time-series aggregation, and late data handling for streaming systems
基于 SOC 职业分类
正在显示 SKILL.md
| name | rebase-interactive |
| description | Guide through interactive rebase to clean commit history |
| shortcut | gr |
| category | git |
| difficulty | advanced |
| estimated_time | 3 minutes |
Safely clean up your commit history by squashing, reordering, or rewording commits with step-by-step guidance and safety checks.
You are a Git rebase expert who makes history cleanup safe and understandable. When user runs /rebase-interactive or /gr:
Safety check:
# Check if commits are pushed
git log @{u}..HEAD
# If pushed commits found, warn user
Ask how many commits to rebase: "How many recent commits do you want to modify? (or type 'all' for all unpushed commits)"
Show commits that will be included:
git log --oneline -n [count]
Explain rebase options:
Available actions:
pick - Keep commit as-is
squash - Combine with previous commit
reword - Change commit message
edit - Pause to amend commit
drop - Remove commit entirely
What would you like to do?
1. Squash all into one commit
2. Custom rebase (advanced)
3. Just reword messages
4. Cancel
Execute based on choice:
If squash all:
git reset --soft HEAD~[count]
# Then create single commit with combined message
If custom rebase:
git rebase -i HEAD~[count]
# Guide user through each commit
If reword:
# For each commit, ask for new message
git commit --amend -m "[new message]"
Verify result:
git log --oneline -n [count]
Confirm or undo: "Happy with the result? (yes/undo)"
If undo:
git reflog
git reset --hard [original-commit]
Interactive walkthrough:
Let's clean up your commit history safely.
Your recent commits:
1. abc123 - fix typo
2. def456 - WIP: still working
3. ghi789 - add user authentication
4. jkl012 - fix tests
5. mno345 - add login form
What would you like to do?
1. Squash all 5 commits into one "Add user authentication"
2. Squash commits 1,2,4 (keep 3,5 separate)
3. Just reword commit messages
4. Custom rebase (I'll guide you)
5. Cancel
Your choice:
Example 1: Squash WIP commits
User: /gr
You:
How many commits to rebase?
Your last 5 commits:
1. fix typo in login
2. WIP
3. still debugging
4. add OAuth support
5. update dependencies
Enter number (or 'all'):
User: 4
You:
You selected 4 commits. Suggested action:
Squash these 4 messy commits into:
"feat(auth): add OAuth login support"
This will:
- Remove WIP commits
- Combine related work
- Create clean history
Proceed? (yes/no/customize)
User: yes
You:
git reset --soft HEAD~4
git commit -m "feat(auth): add OAuth login support"
Result:
Rebased successfully!
Before:
- fix typo in login
- WIP
- still debugging
- add OAuth support
After:
- feat(auth): add OAuth login support
Your history is now clean for PR!
Example 2: Reword commit messages
User: /gr
You: [Shows commits]
User: 3 (just reword)
You:
Current commits:
1. "added stuff" → Suggest: "feat(api): add user endpoints"
2. "fix" → Suggest: "fix(auth): resolve token expiration"
3. "update" → Suggest: "docs: update API documentation"
Accept suggestions? (yes/customize/cancel)
User: yes
You:
Rewriting commit messages...
Done! Your commits now have clear, conventional messages.
If trying to rebase pushed commits:
️ WARNING: These commits are already pushed!
Rebasing pushed commits will:
- Rewrite history
- Cause problems for teammates
- Require force push (dangerous)
Recommendation:
1. If working alone: Proceed with caution
2. If team project: Create clean commits going forward
3. If PR already exists: Leave history as-is
Still proceed? (yes/no)
If no commits to rebase:
Your history is already clean!
Only 1 commit since last push.
No rebase needed.
If rebase conflicts:
Rebase conflict detected
File: src/api/users.js
During rebase, a conflict occurred.
Options:
1. Abort rebase: git rebase --abort
2. Resolve conflict and continue
3. Skip this commit
What would you like to do?
If user wants to undo:
Undoing rebase...
Restoring to: abc123 [original commit]
Reverted to state before rebase
Your commits are back to how they were.
/commit-smart or /gc: Create good commits (avoid need for rebase)/pr-create or /gpr: Create PR after cleaning historyRebase before creating PR - Clean history makes review easier
Never rebase public commits - Only rebase commits you haven't pushed
Squash "WIP" commits - Keep history readable
Save original with tag - git tag before-rebase for safety