git-workflows/skills/troubleshoot-rebase/SKILL.md
Diagnose and recover from git rebase failures
npx skillsauth add jacobpevans/claude-code-plugins troubleshoot-rebaseInstall this skill globally with one command. Works with Claude Code, Cursor, and Windsurf.
3 of 9 scanners reported clean
Some scanners were skipped, did not run, or reported a non-clean status. Review each row below.
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.
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/maingit push --force-with-lease origin HEADIf you are on main and are behind origin/main, do not rebase main:
git fetch origin --force && git reset --hard origin/mainIf the rebase fails because origin/main 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 main -> 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).
Main was updated between rebase and merge. Run git fetch origin --force && git reset --hard origin/main, then retry.
Fix: git push --force-with-lease origin <branch>
git rebase --abort && git status
Before retrying:
git diff origin/main --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.
tools
Use when installing or choosing CLI tools in a Nix flake repo, editing flake.nix or home-manager config, or when tempted to pip/pipx/uv/brew/npm install anything. Tools come from the dev shell or nix shell — never ad-hoc package managers.
testing
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.
development
Use when adding or editing .pre-commit-config.yaml, wiring pre-commit hooks into a repo, scaffolding a new repo's lint/hook setup, or deciding where a hook or shared lint config should live. Covers the canonical nix-devenv/dryvist-.github architecture, profiles, and consumer patterns.
testing
Check PR merge readiness, sync local repo, cleanup stale worktrees; optional cross-repo sweep and stale-branch prune modes