Skip to content

Instantly share code, notes, and snippets.

@hantoine
Created February 4, 2022 16:38
Show Gist options
  • Save hantoine/c819d321661891c8a08cab9e29f04fcd to your computer and use it in GitHub Desktop.
Save hantoine/c819d321661891c8a08cab9e29f04fcd to your computer and use it in GitHub Desktop.
#!/bin/bash
for br in $(git br | cut -c 3-) ; do
if [ "$br" == "master" ] ; then
continue
fi
git co "$br"
state=$(gh pr status --json state --jq .currentBranch.state)
if [ "$state" == "MERGED" ] ; then
git co master
git br -D "$br"
fi
done
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment