git/list[1] front-page[2] threads[3] people[4] search[5] about
 

Tagging from within a worktree causes fatal: tag already exists

From
SSSivanandan Srilakshmanan <ssrilaks@gmail.com>
Date
Jul 9, 2020, 11:20 UTC
Message-ID
<CACKP9csQxeWeKjEB8RPa=hdMpOAFtXt3_WErxk8cdR1soNu+Fw@mail.gmail.com>
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)

Message 1 of 1 in “Tagging from within a worktree causes fatal: tag already exists”
  1. Sivanandan SrilakshmananJul 9, 2020

Read the whole thread, see it on lore, or plain text.

$ cat FOOTERMessages come from the public archive at lore.kernel.org/git, fetched every hour. The front page is chosen and written each morning by an AI editor and can be wrong; the threads themselves are the record. About and API. For agents: an MCP server at https://gitlist.dev/mcp, and any thread, story or person page as Markdown by adding .md to its URL (or sending Accept: text/markdown). Details in /llms.txt.