Skip to content

Instantly share code, notes, and snippets.

@aboritskiy
Created February 20, 2023 14:12
Show Gist options
  • Save aboritskiy/fe27fc16929ef76e20dead2df8fb9a8d to your computer and use it in GitHub Desktop.
Save aboritskiy/fe27fc16929ef76e20dead2df8fb9a8d to your computer and use it in GitHub Desktop.
Remove merged remote branches
#!/bin/bash
set -eu
git fetch -ap
git branch -r --merged origin/master | grep -v master | grep -v dev | grep -v HEAD | sed 's/^ origin\///' | xargs git push --delete origin
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment