Context
- •Branches: !
git branch -v - •Worktrees: !
git worktree list
Task
Clean up local branches that have been deleted from the remote (marked [gone]).
Steps
- •From the branch list above, identify branches marked
[gone] - •If none found, report that no cleanup is needed and stop
- •List the branches that will be deleted and ask for confirmation before proceeding
- •For each confirmed branch:
- •If it has an associated worktree (shown in worktree list), remove the worktree first with
git worktree remove --force - •Delete the branch with
git branch -D
- •If it has an associated worktree (shown in worktree list), remove the worktree first with
- •Report what was removed