Skip to content

Instantly share code, notes, and snippets.

@pablogrs
Created July 25, 2023 12:24
Show Gist options
  • Save pablogrs/7cc8d2515e11186607a410cb19fbf267 to your computer and use it in GitHub Desktop.
Save pablogrs/7cc8d2515e11186607a410cb19fbf267 to your computer and use it in GitHub Desktop.
Delete local branches that have been merged in GitHub Pull Request
for x in $(gh pr list --state merged --json headRefName --limit 400 | jq --raw-output ".[].headRefName"); do
git branch -D $x
done
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment