I am working on a large project where it is split in many repositories.
I am thinking of making a small bash script that iterates and checkouts a specific remote or local branch or tag in each repository, BUT if this fails because the branch doesnt exist, to have a second option of a tag/repository to checkout.
i.e.
#!/bin/bash
printf "\n ### Checkout Tag ### \n \n"
for repo in rep1 rep2 ...
do
checkout $1
(check if that fails somehow, and if it fails, checkout $2)
done
printf "\n ### DONE ### \n \n"
exit 0
Or, do you have an alternative idea?
Thank you
$?. If it's 0 (zero) that means that command succeeded, otherwise it failed.