Safely rebase with automatic backup and conflict handling
Safely rebases branches with automatic backup and conflict handling.
/plugin marketplace add cowwoc/claude-code-cat/plugin install cat@claude-code-catThis skill inherits all available tools. When active, it can use any tool Claude has access to.
Purpose: Safely rebase branches with automatic backup, conflict detection, and recovery guidance.
ALWAYS follow this pattern:
# 1. Create backup
BACKUP="backup-before-rebase-$(date +%Y%m%d-%H%M%S)"
git branch "$BACKUP"
# 2. Verify clean working directory
git status --porcelain # Must be empty
# 3. Execute rebase
git rebase <target-branch>
# 4. Handle conflicts if any (see below)
# 5. Verify result
git log --oneline -10
git diff "$BACKUP" # Content should match (just different history)
# 6. Cleanup backup
git branch -D "$BACKUP"
# When rebase stops due to conflict:
# 1. Check which files have conflicts
git status
# 2. Edit files to resolve conflicts (look for <<<<<<< markers)
# 3. Stage resolved files
git add <resolved-files>
# 4. Continue rebase
git rebase --continue
# If you want to abort:
git rebase --abort
git reset --hard "$BACKUP"
# Detect base branch from worktree metadata (fail-fast if missing)
CAT_BASE_FILE="$(git rev-parse --git-dir)/cat-base"
if [[ ! -f "$CAT_BASE_FILE" ]]; then
echo "ERROR: cat-base file not found. Recreate worktree with /cat:work." >&2
exit 1
fi
BASE_BRANCH=$(cat "$CAT_BASE_FILE")
git rebase "$BASE_BRANCH"
git rebase -i <base-commit>
# In editor:
# pick - use commit as-is
# reword - change commit message
# edit - stop to amend commit
# squash - combine with previous commit
# fixup - like squash but discard message
# drop - remove commit
# Only rebase local/feature branches (not shared ones)
git rebase main # While ON main - rewrites shared history!
# Avoid --all flag (rewrites ALL branches)
git rebase --all # Rewrites ALL branches!
# SAFE - rebase feature branch onto main
git checkout feature
git rebase main
# If rebase went wrong:
git rebase --abort
# Or restore from backup:
git reset --hard $BACKUP
# Or check reflog:
git reflog
git reset --hard HEAD@{N}
This skill should be used when the user asks to "create a hookify rule", "write a hook rule", "configure hookify", "add a hookify rule", or needs guidance on hookify rule syntax and patterns.
Create distinctive, production-grade frontend interfaces with high design quality. Use this skill when the user asks to build web components, pages, or applications. Generates creative, polished code that avoids generic AI aesthetics.