Skip to content
Back to skills

Troubleshoot Worktree

ASecurity

Troubleshoot git worktree, branch, and refname issues

  • 3 stars
  • 0 votes
  • 0 copies
  • 2 views
  • Added September 19, 2026
ai-agentsgobashgit

Security analysis

A100/100

Scanned September 19, 2026

npx -y skills add dryvist/claude-code-plugins --skill troubleshoot-worktree --agent claude-code

Installs into .claude/skills of the current project.

Are you the author of Troubleshoot Worktree?

Add the live security badge to your README. It updates with every re-scan.

Security grade badge for Troubleshoot Worktree
[![Security: A — Skills Directory](https://www.skillsdirectory.com/api/skills/dryvist-troubleshoot-worktree/badge)](https://www.skillsdirectory.com/skills/dryvist-troubleshoot-worktree)

More formats (shields.io, HTML) on the badges page. Keep it an A: scan every change in CI with Pro.

Download with Pro
SKILL.md
---
name: troubleshoot-worktree
description: Troubleshoot git worktree, branch, and refname issues
---

# Git Worktree Troubleshooting

Diagnose and fix worktree, branch, and reference issues.

## Quick Diagnostics

Always run first:

```bash
git worktree list
git branch -a
git status
pwd
```

## Worktree Discovery

**Never assume paths** - always discover with `git worktree list`. The first
column is the path; the bracketed name is the branch checked out there.

## Critical: Ambiguous Refname

**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`.

The same ambiguity can occur for any branch name, not just `main` — on a
git-flow repo (default branch `develop`) watch for `origin/develop` too.
Substitute the branch name in the diagnose/fix commands above.

## Common Errors

### Branch Not Found

```bash
git fetch origin --force
git branch -a | grep -i "<branch>"
```

### Uncommitted Changes

```bash
git add . && git commit -m "WIP"          # Commit
git stash push -m "before operation"      # Stash (temporary)
git checkout -- .                         # Discard (DESTRUCTIVE)
```

### Embedded Git Repository

```bash
git rm --cached <folder>
echo "<folder>/" >> .gitignore
```

## Related Skills

- **troubleshoot-rebase** (git-workflows) — Diagnose and recover from git rebase failures
- **troubleshoot-precommit** (git-workflows) — Troubleshoot pre-commit hook failures
- **refresh-repo** (github-workflows) — Default-branch sync
- **prune-branches** (github-workflows) — Worktree and branch cleanup

Attribution

Is this your skill, or is something wrong with this listing? Request removal or report an issue. Author removals are honored within 72 hours.

Comments

Loading comments…