How to get rid of "would clobber existing tag"

Solution 1:

You should update your local tags with remote tags:

git fetch --tags -f

Then pull again.

Solution 2:

Since you say it's unclear what's going wrong, I assume you're not using that tag for anything and you just want to do your own work.

Turn off this setting:

enter image description here

Or add this "git.pullTags": false in the settings.json file`

Now you're all set.


Detailed explanation:

Tags are just references to specific commits (just like branch names). The main difference is that git (as far as I know) assumes tags will not change, where branches are expected to be updated.

So, the "error" is that you have in your local a tag called latest pointing to commit X - but the remote has a tag called latest pointing to commit Y. If you apply the change from the remote you will overwrite your local tag.

VSCode will pull all tags by default, thus you get the error.

There isn't anything wrong with having a "moving" tag like latest, that just isn't something VSCode takes into account (personal opinion).


Alternatively, you can avoid the issue by using the command line and manually entering the git pull command. Specifically, you need to omit --tags to skip this step of the process.

If you do this, your tags will not be updated - but I don't think is a concern here.