Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to overwrite local tags with git fetch?

Tags:

git

How to overwrite local tags with git fetch? I want to replace local tags with remote tags.

like image 532
linquize Avatar asked Mar 12 '12 05:03

linquize


People also ask

Does git fetch overwrite local changes?

Just like git push --force allows overwriting remote branches, git fetch --force (or git pull --force ) allows overwriting local branches.


1 Answers

As of Git 2.2.0 you need to explicitly specify the force flag:

git fetch origin --tags --force

Until Git version 2.20, and unlike when pushing with git-push[1], any updates to refs/tags/* would be accepted without + in the refspec (or --force). When fetching, we promiscuously considered all tag updates from a remote to be forced fetches. Since Git version 2.20, fetching to update refs/tags/* works the same way as when pushing. I.e. any updates will be rejected without + in the refspec (or --force).

https://git-scm.com/docs/git-fetch

like image 96
gerrard00 Avatar answered Sep 21 '22 20:09

gerrard00