git-abort
Use when a merge, rebase, or cherry-pick has gone wrong and needs to be safely aborted.
用 Codex 或 Claude 帮你安装 复制这段 Prompt,粘贴到 Codex、Claude 或其他助手里,让它检查 Skill 页面并帮你完成安装。
菜单
Use when a merge, rebase, or cherry-pick has gone wrong and needs to be safely aborted.
用 Codex 或 Claude 帮你安装 复制这段 Prompt,粘贴到 Codex、Claude 或其他助手里,让它检查 Skill 页面并帮你完成安装。
Use when designing component interaction specs with visual states, transitions, and accessibility requirements. Covers state matrices, responsive behavior, ARIA compliance, and content constraints. Do not use for multi-step user journey mapping (use journey-mapping).
Use when mapping complete user journeys through multi-step flows, onboarding sequences, or feature workflows. Covers entry points, happy paths, alternate paths, error states, friction analysis, and delight opportunities. Do not use for individual component interaction specs (use interaction-design).
Use when analyzing an existing codebase for architecture, tech stack, conventions, and infrastructure. Covers project structure mapping, data model discovery, integration point cataloging, and constraint identification. Do not use for schema changes (use schema-design) or API contract definition (use api-design).
Use when designing documentation architecture for a project or team. Covers audience mapping, Diataxis framework classification, onboarding path design, format and location decisions, documentation testing, and maintenance scheduling. Do not use for recording individual architecture decisions (use adr-template) or creating versioned changelogs (use changelog-design).
Use when auditing codebase patterns or evaluating proposed changes for convention consistency. Covers file naming, component patterns, data fetching, state management, and type conventions. Do not use for test plan design or coverage targets (use testing-strategy).
Use when classifying data elements by sensitivity tier and defining per-tier handling requirements. Covers data inventory, sensitivity classification, PII flow mapping, encryption and masking specifications, and cross-boundary transfer documentation. Do not use for regulatory gap analysis (use compliance-review) or audit logging design (use audit-trail-design).
| name | git-abort |
| description | Use when a merge, rebase, or cherry-pick has gone wrong and needs to be safely aborted. |
| triggers | ["git abort","abort merge","abort rebase","cancel merge","cancel rebase","undo merge"] |
| version | 1.0.0 |
| user_invocable | true |
merge, rebase, cherry-pick, revert, or omitted for auto-detect. Reject any other value.Safely abort a failed or unwanted merge, rebase, cherry-pick, or revert operation.
/git-abort # Auto-detect and abort current operation
/git-abort merge # Explicitly abort merge
/git-abort rebase # Explicitly abort rebase
/git-abort cherry-pick # Abort cherry-pick
/git-abort revert # Abort revert
# Check for various in-progress states
if [ -d .git/rebase-merge ] || [ -d .git/rebase-apply ]; then
OPERATION="rebase"
elif [ -f .git/MERGE_HEAD ]; then
OPERATION="merge"
elif [ -f .git/CHERRY_PICK_HEAD ]; then
OPERATION="cherry-pick"
elif [ -f .git/REVERT_HEAD ]; then
OPERATION="revert"
else
echo "No operation in progress to abort."
exit 0
fi
echo "Detected in-progress: $OPERATION"
# Show what files are in conflict
echo "Current status:"
git status --short
# Show conflicting files
echo "Conflicting files:"
git diff --name-only --diff-filter=U
case "$OPERATION" in
"merge")
git merge --abort
;;
"rebase")
git rebase --abort
;;
"cherry-pick")
git cherry-pick --abort
;;
"revert")
git revert --abort
;;
esac
# Confirm we're back to clean state
echo "Restored to previous state."
git status --short
git log --oneline -1
Aborting merge...
Previous state:
Merging main into feat/dark-mode
Conflicts in 2 files
Merge aborted successfully!
Current state:
Branch: feat/dark-mode
Status: Clean working directory
HEAD: abc1234 Your last commit before merge
What to do next:
/git-merge-main # Try merge again after preparation
/git-rebase # Try rebase instead (cleaner history)
/git-stash # Stash any partial work
Aborting rebase...
Rebase was in progress:
Rebasing feat/dark-mode onto main
Stopped at commit def5678
Rebase aborted successfully!
Current state:
Branch: feat/dark-mode
Status: Clean working directory
HEAD: ghi9012 (back to before rebase)
Your commits are restored to their original state.
Alternative approaches:
/git-merge-main # Merge instead of rebase
/git-conflicts # Get help resolving conflicts next time
Aborting cherry-pick...
Was cherry-picking:
Commit abc1234 from main
Cherry-pick aborted!
Current state:
Branch: feat/dark-mode
Status: Clean
The cherry-picked commit was not applied.
No operation in progress.
Current state:
Branch: feat/dark-mode
Status: Clean working directory
Nothing to abort.
| Operation | What Abort Does |
|---|---|
merge --abort | Removes merge state, restores HEAD |
rebase --abort | Stops rebase, restores original branch state |
cherry-pick --abort | Cancels cherry-pick, cleans up |
revert --abort | Cancels revert, cleans up |
After aborting, you can:
Try again with preparation:
/git-stash # Save any work
/git-sync # Make sure you're up to date
/git-merge-main # Try again
Use a different strategy:
# If merge had too many conflicts, try rebase
/git-rebase
# Or vice versa
/git-merge-main
Get help with conflicts:
/git-conflicts # Guided conflict resolution
/git-merge-main or /git-rebase results in conflicts/git-conflicts to get help before aborting/git-stash to save any partial work