CCIB_8899
CCIB_8899

Reputation: 15

GIT returning fatal "[tag] already exists" error when Deleting then Recreating Tags

In GIT, I am trying to execute a series of GIT commands to delete an existing tag then recreate it. However, it is returning a "fatal: tag '2.0.1' already exists" error. Anyone have any idea what I'm doing wrong or what command I'm possibly missing?

I am executing the following sequence of commands:

git clone [email protected]/test_project project_dir
cd project_dir
git push --delete origin 2.0.1
git tag 2.0.1 -m "Recreated tag"

Currently to work around this, after I execute the push --delete command, I'm deleting project_dir and recloning the repo to create the tag, which isn't very efficient.

Upvotes: 0

Views: 1661

Answers (1)

mipadi
mipadi

Reputation: 410972

You also have to delete your local copy of the tag:

git tag -d 2.0.1

Deleting it from the remote does not delete it from your local repository.

Upvotes: 5

Related Questions