How to update your local git tags with the remote tags
When someone deletes a git tag on a remote and then creates a new tag with the same name, `git fetch` or `git pull` can fail with this error:
```bash
! [rejected] 2.10.14 -> 2.10.14 (would clobber existing tag)
```
Git refuses to overwrite a local tag that points to a different commit than the remote tag.
The solution is to update your local tags with the remote tags. Force-fetch them:
```bash
git fetch --tags --force
```
`--force` (or `-f`) lets git replace the local tags that differ from the remote ones. Since Git 2.20, a plain `git fetch --tags` no longer updates existing tags, so you need the flag.
Zeno Popovici
09 Sep 2021
« Back to post