vendredi 22 septembre 2017

How to check if tag exists in if/else

How can I check if a tag exists in my GIT repo. I get as input some tagname and I have to check if it's a valid tag with a if else statement. TAG="tagname"

I tried:

if [ git rev-parse ${TAG} >/dev/null 2>&1 ]; then
  echo "tag exists";
else
  echo "tag does not exist";

But it didn't work

Aucun commentaire:

Enregistrer un commentaire