Git Worktree Cleanup And Branch Reconciliation

Systematic process for cleaning up stale git worktrees, resolving merge conflicts in diverged branches, and reconciling branch state across multiple repositories.

vamseeachanta Updated

File contents

Git Worktree Cleanup and Branch Reconciliation

When managing multiple repos with stale branches and orphaned worktrees: (1) Identify worktrees attached to merged/stale branches using git worktree list, (2) Remove stale worktrees with git worktree remove to unblock branch deletion, (3) Categorize remaining branches (merged, feature-complete, orphaned from history rewrites), (4) For branches with unmerged content, pull latest main first to detect upstream merges, then resolve conflicts by keeping HEAD (main) on surrounding files while preserving the branch's actual fix logic, (5) Delete superseded branches and verify all repos are clean. Key insight: Worktrees block deletion and consume disk; history rewrites create "no common ancestor" branches that can't merge.

vamseeachanta/workspace-hub/tree/main/.agents/skills/workspace-hub/learned/git-worktree-cleanup-and-branch-reconciliation commit 45256cb262

Frequently asked questions

npx skillmds@latest add vamseeachanta/git-worktree-cleanup-and-branch-reconciliation