Last active
April 20, 2020 14:29
-
-
Save marcocarvalho/ee7fcf288d0c51639bcd5f625c340057 to your computer and use it in GitHub Desktop.
Remove branches from CM
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# select concat('drop database if exists ', datname, ';') from pg_database where left(datname, 11) = 'caremessage' and datname not like '%master%' and datname not like '%staging%' | |
ignores=(\* master staging) | |
for branch in $(git branch) | |
do | |
if [[ " ${ignores[@]} " =~ " ${branch} " || "$CURRENT_WORK" = "$branch" ]]; then continue; fi | |
git checkout $branch | |
if [[ "$?" != "0" ]]; then continue; fi | |
echo "drop database if exists caremessage_dev_$branch;" >> drop_databases.sql | |
echo "drop database if exists caremessage_test_$branch;" >> drop_databases.sql | |
git checkout master | |
git branch -D $branch | |
done |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment