Skip to content

Instantly share code, notes, and snippets.

@jbn
Created September 21, 2023 17:12
Show Gist options
  • Save jbn/a31140700237027fa522aac7012fd3d9 to your computer and use it in GitHub Desktop.
Save jbn/a31140700237027fa522aac7012fd3d9 to your computer and use it in GitHub Desktop.
#!/bin/bash
# Fetch updates from remote
git fetch
# Loop over all branches except main
for branch in $(git branch | grep -v "main"); do
# Delete the branch
git branch -D $branch
done
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment