Skip to content

Instantly share code, notes, and snippets.

@zsoobhan
Last active July 19, 2018 06:42
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save zsoobhan/53b598da50a5496f655a07bb9fb39151 to your computer and use it in GitHub Desktop.
Save zsoobhan/53b598da50a5496f655a07bb9fb39151 to your computer and use it in GitHub Desktop.
Lists all branches on remote repository that are merged to develop

Usage:

bash list_merged_remote_and_delete.sh
git branch -r --merged develop |
grep origin |
grep -v develop |
grep -v release |
grep -v master |
sed -E "s|^ *origin/||"
for branch in $(git branch -r --merged develop | grep origin | grep -v develop | grep -v release | grep -v master | sed -E "s|^ *origin/||g")
do
git push origin $branch --delete
done
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment