ワンクリックで
git-operations
Use when pushing, pulling, or merging changes. Handles retries, conflicts, and error recovery.
Codex または Claude でインストール この Prompt をコピーして Codex、Claude、または他のアシスタントに貼り付けると、Skill ページを確認してインストールできます。
メニュー
Use when pushing, pulling, or merging changes. Handles retries, conflicts, and error recovery.
Codex または Claude でインストール この Prompt をコピーして Codex、Claude、または他のアシスタントに貼り付けると、Skill ページを確認してインストールできます。
SOC 職業分類に基づく
| name | git-operations |
| description | Use when pushing, pulling, or merging changes. Handles retries, conflicts, and error recovery. |
Purpose: Safe push/pull/merge operations with retry logic and error handling Target: All git operations
# Push with retry (3 attempts, 2s delay)
git_push_with_retry() {
local branch="${1:-$(git rev-parse --abbrev-ref HEAD)}"
for attempt in {1..3}; do
git push origin "$branch" 2>&1 && return 0
echo "Retry $attempt/3..." && sleep 2
done
return 1
}
# Pull with fast-forward only
git pull --ff-only || echo "Manual merge required"
Purpose: Handle transient network failures with exponential backoff (3 attempts, 2s/4s/8s delay)
git_push_with_retry() {
local remote="${1:-origin}"
local branch="${2:-$(git rev-parse --abbrev-ref HEAD)}"
local max_attempts=3
local wait_times=(2 4 8) # Exponential backoff
echo "🔄 Pushing to $remote/$branch..."
for attempt in $(seq 1 $max_attempts); do
# Attempt push
if git push "$remote" "$branch" 2>&1; then
echo "✓ Push successful"
return 0
fi
local exit_code=$?
local error_output="$(git push "$remote" "$branch" 2>&1 || true)"
# Classify error
if echo "$error_output" | grep -qiE "non-fast-forward|rejected|protected"; then
echo "❌ Push rejected (non-fast-forward or protected branch)"
echo " Run: git pull --rebase && git push"
return 1
elif echo "$error_output" | grep -qiE "authentication|permission|credentials"; then
echo "❌ Authentication error"
echo " Check git credentials: git config --list | grep credential"
return 1
fi
# Retry for network/transient errors
if [ $attempt -lt $max_attempts ]; then
local wait_time=${wait_times[$((attempt-1))]}
echo "⚠️ Push failed (attempt $attempt/$max_attempts), retrying in ${wait_time}s..."
sleep "$wait_time"
else
echo "❌ Push failed after $max_attempts attempts"
return 1
fi
done
return 1
}
Error Classification:
Retry Strategy:
Purpose: Avoid destructive merges, ensure clean working tree
git_pull_safe() {
# Check for uncommitted changes
git diff-index --quiet HEAD -- || { echo "Uncommitted changes" >&2; return 1; }
# Fast-forward only
git pull --ff-only || { echo "Manual merge required" >&2; return 1; }
}
Purpose: Safe branch merging with conflict detection
git_merge_safe() {
local source="$1"
local target="${2:-$(git rev-parse --abbrev-ref HEAD)}"
git checkout "$target" || return 1
if git merge "$source" --no-ff --no-edit; then
echo "✓ Merged $source into $target"
else
echo "⚠️ Conflicts in:" && git diff --name-only --diff-filter=U
echo "Resolve, then: git add <files> && git commit"
return 1
fi
}
| Error | Cause | Solution |
|---|---|---|
Failed to connect | Network issue | Retry with git_push_with_retry |
rejected (non-fast-forward) | Remote has new commits | Pull first, then push |
conflict | Branches diverged | Manual merge required |
uncommitted changes | Dirty working tree | Commit or stash first |
# After merge conflict
git status # List conflicted files
vim conflicted-file.ts # Resolve markers
git add conflicted-file.ts
git commit
# Abort operations
git merge --abort # Abort merge
git rebase --abort # Abort rebase
git reset --hard HEAD # Reset to safe state
git_operation_with_fallback() {
eval "$1" && return 0
case "$(git status 2>&1)" in
*connection*) return 2 ;; # Retryable
*conflict*) return 3 ;; # Needs intervention
*) return 1 ;; # Fatal
esac
}
Version: claude-pilot 4.2.0
Coordinate specialized teammates in Agent Teams for execution, review, and planning. Delegate mode mandatory with TaskCompleted/TeammateIdle hooks.
Plan completion workflow - archive plan, verify todos, create git commit, push with retry. Use for finalizing completed plans.
Plan confirmation workflow - extract plan from conversation, create file, auto-review with Interactive Recovery. Use for confirming plans after /00_plan.
Plan execution workflow - parallel SC implementation, worktree mode, verification patterns, GPT delegation. Use for executing plans with TDD + Ralph Loop.
Use when blocked, stuck, or needing fresh perspective. Consults GPT experts via Codex CLI with graceful fallback.
Coordinate independent teammates concurrently in Agent Teams for 50-70% speedup. Launch multiple teammates simultaneously.