#!/bin/bash
# Delete branch from each repo at origin (gitlab) and locally

# Verify that we are in the super-repo
[ -d CanAM ] ||  { echo "ERROR: You MUST be in the CanESM super-repo" ; exit 1 ; }

# First recurse every submodule from the bottom up.
# This makes sure that when modifying a "lower" submodule
# the "higher" one knows about it, including the super-repo.
git sfed "git push origin --delete $1 || :"
git sfed "git branch -D $1 || :"

# Repeat the same thing in the super-repo
git push origin --delete "$1"
git branch -D $1

