Git: How to make an existing git easy dot tag for another commit?

In the Git test repository, git log is issued:

 commit e1f972f22f9906ad62007b4e372d8dc06bc47656 Author: davidandreoletti Date: Sun Mar 18 11:23:09 2012 +0800 Added 0 commit 81a07eeffc58b054d4c083a0d7c1d4aa0b0440d5 Author: davidandreoletti Date: Sun Mar 18 10:46:44 2012 +0800 first commit 

and git tag 0.0.2 is a lightweight tag indicating a commit 81a07eeffc58b054d4c083a0d7c1d4aa0b0440d5 . All commits have been migrated to the remote repository (including tags).

In this context, how to make an existing Git "easy tag" point to another commit? That is, I want the tag "0.0.2" to indicate a commit e1f972f22f9906ad62007b4e372d8dc06bc47656 instead of 81a07eeffc58b054d4c083a0d7c1d4aa0b0440d5

+4
source share
2 answers

Just remove the old tag and create a new one.

 git tag -d 0.0.2 git tag 0.0.2 e1f97... 

Assuming you have a remote repository you're working with, you also need to:

 git push --tag --force <remote> 
+4
source

Generally, you should not do this. Git will come out of it to try and stop you, however

 git tag -d 0.0.2 git tag 0.0.2 e1f972f22f9906ad62007b4e372d8dc06bc47656 

Should work if it has not been pressed.

+1
source

Source: https://habr.com/ru/post/1402061/


All Articles