Re: changing git tags on the remote repo
- Date: Tue, 14 Aug 2018 12:41:04 +0200
- From: Wouter Verhelst <wouter@xxxxxxxxxx>
- Subject: Re: changing git tags on the remote repo
On Sun, Aug 12, 2018 at 01:12:40PM +0200, Holger Wansing wrote:
> I am curious about how to change an already existing git tag afterwards
> (means: change the commit it points to).
> Locally, I can change an existing tag, and then create it newly.
> But I cannot push it to the remote repo (get
> "! [rejected] 139 -> 139 (already exists) "
> There is -f (--force) option to replace an existing tag and locally it seems
> to work, since it says
> "Tag '139' updated (was 02108ec)"
> but the push to remote repo fails nevertheless.
> Any help?
Delete the old one first, then recreate it:
git push origin :139
git push origin 139
This is because tags are not meant to be updated, only to be added to --
other than branches, tags are meant as final,
create-once-and-never-update style, names. As such, even if you replace
a tag remotely, anyone who has already fetched it would need to
explicitly drop the tag locally and recreate it; git does not
auto-update tags that changed remotely.
In that light, it is probably better to just skip the 139 tag and move
on to 140.
Could you people please use IRC like normal people?!?
-- Amaya Rodrigo Sastre, trying to quiet down the buzz in the DebConf 2008