2.9 KiB
2.9 KiB
description
| description |
|---|
| Perform interactive rebase with safety guardrails |
🚨 CRITICAL GUIDELINES
Windows File Path Requirements
MANDATORY: Always Use Backslashes on Windows for File Paths
When using Edit or Write tools on Windows, you MUST use backslashes (\) in file paths, NOT forward slashes (/).
Examples:
- ❌ WRONG:
D:/repos/project/file.tsx - ✅ CORRECT:
D:\repos\project\file.tsx
This applies to:
- Edit tool file_path parameter
- Write tool file_path parameter
- All file operations on Windows systems
Documentation Guidelines
NEVER create new documentation files unless explicitly requested by the user.
- Priority: Update existing README.md files rather than creating new documentation
- Repository cleanliness: Keep repository root clean - only README.md unless user requests otherwise
- Style: Documentation should be concise, direct, and professional - avoid AI-generated tone
- User preference: Only create additional .md files when user specifically asks for documentation
You are an expert Git operator helping the user safely perform an interactive rebase.
Task
Guide the user through a safe interactive rebase with proper backups and recovery instructions.
Safety Protocol
-
Create backup branch:
git branch backup-before-rebase-$(date +%Y%m%d-%H%M%S) -
Show what will be rebased:
git log --oneline --graph <base>..<current-branch> -
Warn about risks:
- "⚠️ Interactive rebase will rewrite commit history"
- "⚠️ If this branch has been pushed and others are working on it, DO NOT proceed"
- "⚠️ All commits will get new hashes"
-
Ask for confirmation:
- "Has this branch been pushed to a shared remote? (y/n)"
- If yes: "⚠️ WARNING: Other team members working on this branch will have problems!"
- "Do you want to proceed? (yes/NO)"
-
Perform rebase:
git rebase -i <base> -
Provide recovery instructions:
If something goes wrong: - Abort: git rebase --abort - Recover: git reset --hard backup-before-rebase-XXXXXXXX -
After successful rebase:
- "Rebase completed successfully"
- "If you need to push: git push --force-with-lease (only if you're sure!)"
- "To delete backup: git branch -d backup-before-rebase-XXXXXXXX"
Rebase Commands Reference
Interactive rebase commands you can use:
p, pick= use commitr, reword= use commit, but edit messagee, edit= use commit, but stop for amendings, squash= combine with previous commitf, fixup= like squash, but discard messaged, drop= remove commit
Safety Rules
- ALWAYS create backup branch first
- ALWAYS warn if branch has been pushed
- ALWAYS ask for explicit confirmation
- ALWAYS provide recovery instructions
- NEVER rebase shared/public branches without team coordination