threads / discuss / 53823

Tagging from within a worktree causes fatal: tag already exists

Subject: Tagging from within a worktree causes fatal: tag already exists

## tl;dr

One message between Jul 9, 2020 and Jul 9, 2020.

replies: 0people: 1as markdown or json

Sivanandan Srilakshmanan· Jul 9, 2020, 11:20 UTC · lore
Hi,

I have been using git and worktree for about 8 months and getting my team upto speed, with absolute success. Thanks for your help during my initial stages.

I am in the production readiness phase and wanted to merge the branch into master, tag and deploy into UAT.

When I run "git tag -l" on any worktree, they all list the tag created in proj1 (1.0.0-1). But when I run "git show 1.0.0-1" it is associated only with proj1 (see listing below) The issue is, I am unable to create a tag 1.0.0-1 in any other worktree.

In summary, I performed the following steps.  proj1 & proj2 are two
different git repositories.
1. Checked out master (proj1) into a local-directory-proj1-master using worktree
2. Merged the dev-branch into master
3. Pushed the change to central server
4. From the local-directory-proj1-master, I created a tag (1.0.0-1)
5. pushed the tag  to central server
6.  Checked out master (proj2) into a local-directory-proj2-master
using worktree
     Performed steps 2 & 3 above for proj 2
7.  From the local-directory-master (proj2) , I created a tag (1.0.0-1)
     fatal: tag '1.0.0-1' already exists
Your assistance is greatly appreciated.

Thanks Lakshman

Please find detail steps below

proj1 => remote (origin) Local_proj1-DEV => Development Branch proj1/master => Remote Tracking branch

git worktree add --checkout c:\source\proj1-master -b Local-proj1-master proj1/master

cd c:\source\proj1-master
C:\Source\proj1-master>git merge Local_proj1-DEV
C:\Source\proj1-master>git push proj1 HEAD:master
C:\Source\proj1-master>git tag -a -m "Initial release candidate" 1.0.0-1
C:\Source\proj1-master>git show 1.0.0-1
tag 1.0.0-1
Tagger: Lakshman <sadsd>
Date:   Thu Jul 9 17:38:23 2020 +1000
Initial release candidate

commit 99fe92 (HEAD -> Local-proj1-master, tag: 1.0.0-1, proj1/master, proj1/dev, Local_proj1-DEV)

git push proj1 1.0.0-1
cd c:\source\proj2-master

C:\Source\proj2-master>git tag 1.0.0-1 fatal: tag '1.0.0-1' already exists

c:\source\proj2-master>git show 1.0.0-1
tag 1.0.0-1
Tagger: Lakshman <sadsd>
Date:   Thu Jul 9 17:38:23 2020 +1000
Initial release candidate

commit 99fe92 (tag: 1.0.0-1, proj1/master, proj1/dev, Local_proj1-DEV, Local-proj1-master)

← back to recent threads