Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 2 additions & 3 deletions plugins/commit-commands/commands/clean_gone.md
Original file line number Diff line number Diff line change
Expand Up @@ -26,10 +26,10 @@ You need to execute the following bash commands to clean up stale local branches
Execute this command:
```bash
# Process all [gone] branches, removing '+' prefix if present
git branch -v | grep '\[gone\]' | sed 's/^[+* ]//' | awk '{print $1}' | while read branch; do
git branch -v | grep '\[gone\]' | sed 's/^[+* ]//; s/[[:space:]].*$//' | while read branch; do
echo "Processing branch: $branch"
# Find and remove worktree if it exists
worktree=$(git worktree list | grep "\\[$branch\\]" | awk '{print $1}')
worktree=$(git worktree list | grep "\\[$branch\\]" | sed 's/[[:space:]].*$//')
if [ ! -z "$worktree" ] && [ "$worktree" != "$(git rev-parse --show-toplevel)" ]; then
echo " Removing worktree: $worktree"
git worktree remove --force "$worktree"
Expand All @@ -50,4 +50,3 @@ After executing these commands, you will:
- Provide feedback on which worktrees and branches were removed

If no branches are marked as [gone], report that no cleanup was needed.