git - Tags with the same name with a branch
First, we extract all the tags:
git tag | sort > tags
And branches, if you want to check this with local branches:
git branch | sed -e 's/^[ \t]*//' | sort > branches
Or branches of a specific remote, like origin
git branch -r | grep origin/ | sed -e 's:^[ \t]*origin/::' | sort > branches
After extracting tags and branches (in sorted order), we find the common lines in these 2 files:
comm -1 -2 tags branches > bad-tags
And view the file bad-tags
Then we can delete all of them:
cat bad-tags | xargs git tag -d