ワンクリックで
troubleshoot-rebase
Diagnose and recover from git rebase failures
Codex または Claude でインストール この Prompt をコピーして Codex、Claude、または他のアシスタントに貼り付けると、Skill ページを確認してインストールできます。
メニュー
Diagnose and recover from git rebase failures
Codex または Claude でインストール この Prompt をコピーして Codex、Claude、または他のアシスタントに貼り付けると、Skill ページを確認してインストールできます。
SOC 職業分類に基づく
Use when creating PRs, linking issues, managing PR comments, or creating GitHub issues
Use when creating or editing GitHub Actions workflows that call reusable workflows (uses: OWNER/repo/.github/workflows/...) — org owner references must be the literal current org, and shared-CI homes are under dryvist.
Emit a paste-ready two-part handoff for a fresh session: a `## Goal statement` hard-capped under 4000 characters (measured with wc -c, never estimated) that pastes straight into Claude Code's /goal Stop hook, plus an unbounded `## Full prompt` carrying cwd, ordered reading list, hard rules, pitfalls, and deliverables. Use when forking work to a new session, spinning up an orchestrator, or when wrap-up needs a next-session prompt with a real goal and not just a task list.
Analyzes current session state and repository status without any cleanup. Full mode (default): resolves the active plan file, reads plan checklist + TaskList, gathers unfinished work/issues from conversation history, checks git status, and emits a /handoff-built next-session prompt. Mid-session mode (`/session-status mid`): a fast plain-language 'done vs remaining' snapshot for mid-flight orientation, skipping the history scan, triage, and handoff.
End-of-session handler that first checks whether the current session's plan is actually complete. If complete: refresh repo, run quick retrospective, clean gone branches, and emit a forward-looking follow-up prompt. If incomplete: skip cleanup and emit one or more `cd`-into-worktree blocks paired with ready-to-paste resume prompts so the unfinished work can be picked up cold in a new session.
Automatically finalize pull requests for merge by resolving CodeQL violations, review threads, merge conflicts, and CI failures. Handles single PR (current branch or by number), all open PRs in the repo, or all open PRs across the org. Includes bot-authored PRs in all modes.
| name | troubleshoot-rebase |
| description | Diagnose and recover from git rebase failures |
Diagnose and recover from rebase failures. Invoke when standard rebase error handling cannot resolve the issue.
Check: pwd, git status, git branch --show-current, git worktree list, gh pr view.
Resolve the repo's default branch before any rebase — it is the correct rebase
target, not necessarily main:
DEFAULT_BRANCH=$(gh repo view --json defaultBranchRef --jq '.defaultBranchRef.name')
main on a git-flow repo (default branch develop, see /gh-cli-patterns
Canonical Default-Branch Detection in github-workflows) is never a rebase
target — it takes merge commits only. Feature branches there rebase onto
develop, and only a hotfix/* branch legitimately rebases onto main.
Branches have diverged. First, confirm your current branch: git branch --show-current.
If this is a feature branch (for example feature/foo) and the push was rejected:
git fetch origin --force && git rebase origin/<DEFAULT_BRANCH>git push --force-with-lease origin HEADIf you are on <DEFAULT_BRANCH> and are behind origin/<DEFAULT_BRANCH>, do
not rebase it:
git fetch origin --force && git reset --hard origin/<DEFAULT_BRANCH><DEFAULT_BRANCH> and push the feature branch).If the rebase fails because origin/<DEFAULT_BRANCH> moved again, repeat: fetch, rebase your feature branch, then push with --force-with-lease.
GH013 error about PR/status checks. This is NOT a block if commits are from approved PR.
Causes: CI not passing, reviews not approved, merge conflict.
Fix order: Rebase feature -> push (triggers CI) -> wait for checks -> merge to <DEFAULT_BRANCH> -> push.
Check: gh pr view <branch> --json checks,reviews,statusCheckRollup
Nested .git directory found. Fix: git rm --cached <folder-name> or add to .gitignore.
Identify: git status, git diff --name-only --diff-filter=U
Resolve: edit files, git add <file>, then git rebase --continue (or --abort).
The default branch was updated between rebase and merge. Run
git fetch origin --force && git reset --hard origin/<DEFAULT_BRANCH>, then retry.
Fix: git push --force-with-lease origin <branch>
git rebase --abort && git status
Before retrying:
git diff origin/<DEFAULT_BRANCH> --stat (should be empty)git status.git/rebase-{merge,apply} doesn't existgh pr view <branch> --json stateIf unresolved: check git reflog, review git log -10 --oneline, ask user.
DO NOT: Use --force (use --force-with-lease), use gh pr merge, run git rebase -i.