Skip to content

Instantly share code, notes, and snippets.

@taisyo7333
Created November 30, 2020 06:34
Show Gist options
  • Save taisyo7333/bfe6886035c62cd722a8a2fe67847ecd to your computer and use it in GitHub Desktop.
Save taisyo7333/bfe6886035c62cd722a8a2fe67847ecd to your computer and use it in GitHub Desktop.
Remove topic branches except master and current branches
#!/bin/bash
git branch | grep -v "\\*" | grep -v master | xargs git branch -d
# if you would like to remove branches forcely , you can do this like below.
# git branch | grep -v "\\*" | grep -v master | xargs git branch -d
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment