git-worktree-submodule-fetch-repair

Diagnose and repair git fetch failures caused by broken submodule state in linked worktrees.

Updated May 18, 2026
One-click install
npx skills add https://github.com/blalor/pi-dot-dev --skill git-worktree-submodule-fetch-repair-blalor
Or copy as Structured Prompt for Agent▼
Please help me install this Agent Skill.
Skill: git-worktree-submodule-fetch-repair
Source: https://github.com/blalor/pi-dot-dev/tree/main/agent/skills/git-worktree-submodule-fetch-repair
Command: npx skills add https://github.com/blalor/pi-dot-dev --skill git-worktree-submodule-fetch-repair-blalor

SYSTEM DOCUMENTATION & REQUIREMENTS

What problem does it solve? Running git fetch --all inside a linked git worktree can fail with errors like "'origin' does not appear to be a git repository" or "Unable to find current revision in submodule path" when a submodule's per-worktree gitdir is corrupt or partially initialized. This Skill provides a structured investigation and repair procedure to restore fetching without destroying local work. ## Core Features & Use Cases - Guided Diagnosis: Step-by-step commands to inspect submodule status, remotes, gitdir resolution, and HEAD validity in both the linked worktree and the main worktree. - Safe Repair Path: A staged repair flow starting with git submodule deinit/sync/update --init, escalating to removal of the broken per-worktree gitdir only when necessary, with safety checks for uncommitted local work. - Worktrunk Awareness: Distinguishes between a genuinely corrupt submodule and a fresh Worktrunk worktree where submodules were simply never initialized. - Use Case: After creating a new worktree with Worktrunk, git fetch --all fails while fetching services/weave-python/weave-public. Follow the investigation steps to confirm the per-worktree gitdir lacks remote.origin.url, then run the repair sequence to reinitialize the submodule and verify git fetch --all exits 0. ## Quick Start Ask the assistant to diagnose why git fetch --all fails on a submodule in your linked worktree and walk you through the safe repair steps.

Frequently Asked Questions about git-worktree-submodule-fetch-repair

High-intent search queries and answers about installing and using this skill.

FAQPage Schema
How do I fix 'origin does not appear to be a git repository' in a git submodule?▼

This error occurs when a submodule's per-worktree gitdir lacks a configured remote.origin.url. Run git submodule deinit -f, then git submodule sync, then git submodule update --init on the failing path to recreate the submodule configuration.

Why does git fetch --all fail in a linked worktree but not the main worktree?▼

Linked worktrees store submodule gitdirs separately under .git/worktrees/<name>/modules/, and these can become corrupt or partially initialized independently of the main worktree. The main worktree's shared submodule repository may be perfectly healthy.

How do I fix 'Unable to find current revision in submodule path'?▼

This happens when the submodule's HEAD cannot resolve, often after deinit. Remove the broken submodule working tree and its per-worktree gitdir, then run git submodule sync and git submodule update --init to reinitialize it cleanly.

Does a fresh Worktrunk worktree initialize git submodules automatically?▼

No, a freshly created Worktrunk worktree does not necessarily initialize submodules, especially if repository hooks skip submodule update. An uninitialized submodule may print warnings during fetch but still exit 0, which differs from a corrupt partially-initialized state.

Is it safe to delete a broken submodule directory in a worktree?▼

Only after checking for local work with git status inside the submodule and confirming the shared submodule repository under the main worktree is healthy. The repair procedure captures the gitdir path before deletion and reinitializes from the configured remote.