git-workflows/skills/troubleshoot-worktree/SKILL.md
Troubleshoot git worktree, branch, and refname issues
npx skillsauth add jacobpevans/claude-code-plugins troubleshoot-worktreeInstall 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 fix worktree, branch, and reference issues.
Always run first:
git worktree list
git branch -a
git status
pwd
Never assume paths - always discover with git worktree list. The first
column is the path; the bracketed name is the branch checked out there.
Warning: warning: refname 'origin/main' is ambiguous
Means TWO things named origin/main:
refs/heads/origin/main - LOCAL branch (bad)refs/remotes/origin/main - remote tracking (good)Diagnose: git show-ref origin/main
Fix: git branch -D origin/main then verify only 1 line remains with git show-ref origin/main.
git fetch origin --force
git branch -a | grep -i "<branch>"
git add . && git commit -m "WIP" # Commit
git stash push -m "before operation" # Stash (temporary)
git checkout -- . # Discard (DESTRUCTIVE)
git rm --cached <folder>
echo "<folder>/" >> .gitignore
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