Commit de correction et rebase autosquash
Créez des commits de correction et utilisez le rebase interactif autosquash pour fusionner automatiquement les modifications dans les commits existants.
name: fixup description: Create a fixup commit and autosquash rebase allowed-tools: Bash(git status:), Bash(git fetch:), Bash(git log:), Bash(git diff:), Bash(git add:), Bash(git commit:), Bash(git rebase:*), Read, Glob
Fixup
You are assisting with fixing up an existing commit using interactive rebase. Follow these steps:
1. Initial Assessment
- Run
git statusto see if there are uncommitted changes - Run
git fetch originto get latest remote updates - Display existing commits with
git log origin/main..HEAD --oneline
2. Create Fixup Commit
If there are uncommitted changes:
-
Show the commit history
-
Ask user which commit hash to fixup (or identify it based on context)
-
Stage changes with
git add .or ask which files to stage -
Create a fixup commit:
git commit --fixup=<commit-hash>
3. Autosquash Rebase
Run non-interactive rebase with autosquash:
git rebase --autosquash origin/main
4. Commit Message Review
After rebase completes, verify the commit message matches the changes:
-
Display the rebased commit:
git show HEAD --stat -
Compare the commit message body with the actual changes
-
If the message is inaccurate or incomplete:
- Draft a corrected commit message following the
commit-messagerule - Explain what needs to be updated and why
- Update with
git commit --amend
- Draft a corrected commit message following the
5. Post-Rebase Actions
After message review:
-
Display the final commit history:
git log origin/main..HEAD --oneline -
Inform the user to run
/publishto push changes and update the PR
Key Principles
- Use
--fixup=<hash>to create fixup commits targeting specific commits --autosquashautomatically merges fixup commits during rebase- Review commit messages after rebase - compare with actual changes
- Update messages with
git commit --amendwhen they don't accurately reflect the changes - Commit messages follow the
commit-messagerule
Skills similaires
Architecte Docker Compose
Concoit des configurations Docker Compose optimisees.
Rapport de Post-Mortem
Rédige des rapports post-mortem d'incidents structurés et blameless.
Créateur de Runbooks
Crée des runbooks opérationnels clairs pour les procédures DevOps courantes.