Skip to content

Commit

Permalink
fix: add rm branch no longer on remote
Browse files Browse the repository at this point in the history
  • Loading branch information
bigint committed Dec 11, 2023
1 parent 8a65623 commit 230232a
Showing 1 changed file with 2 additions and 0 deletions.
2 changes: 2 additions & 0 deletions script/clean-branches
Original file line number Diff line number Diff line change
Expand Up @@ -5,4 +5,6 @@

echo "Deleting all branches except 'main', 'testnet' and 'staging' 馃棏"
git branch | grep -v "main" | grep -v "testnet" | grep -v "staging" | xargs git branch -D
echo "Deleting branches that no longer exist on remote 馃棏"
git fetch -p && for branch in $(git for-each-ref --format '%(refname) %(upstream:track)' refs/heads | awk '$2 == "[gone]" {sub("refs/heads/", "", $1); print $1}'); do git branch -D $branch; done
echo "Branches deleted 馃帀"

0 comments on commit 230232a

Please sign in to comment.