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

Re: any way to apply tag across all branches in repository?

From
Brandon Casey <casey@nrlssc.navy.mil>
Date
May 19, 2009, 18:36 UTC
Message-ID
<NFLo0xGp2o-oBdtr_pq1jvwATe1ZALaD9dHkr5hmKNkU30gr_isMpQ@cipher.nrlssc.navy.mil>
In-Reply-To
<4A12F0ED.4070707@nortel.com>
Chris Friesen wrote:
Show 20 quoted lines
> Brandon Casey wrote:
> 
>> If I understand you correctly, you are doing your primary development on
>> the "main" branch and then merging this into the architecture specific
>> branches which contain additional architecture specific changes.
> 
> Correct.
> 
>> All you need to do is tag the "main" branch.  Actually, you are tagging
>> the commit that the branch currently points at.  When this branch is
>> merged into the other branches, they will also contain this commit, and
>> 'git describe' will use the tag you created when generating the version
>> string.
> 
> I think this would work if the most recent commit is on the main branch.
> 
> However, if I make a change on the arch-specific branch, then tag the
> main branch and merge it into the arch-specific branch, git tells me
> the arch-specific branch is already up-to-date and the tag doesn't
> get propagated.

Tags aren't versioned. They exist outside of the branch namespace. So merging doesn't have any direct effect on tags. It is the _commits_ that are merged in (which the tags point to). If you have already merged the main branch into the arch-specific branch, then there is nothing else for git to do. Your repository looks something like this graph:

    --o--o---o---o---o---o--o   "arch"
     /                  /
   -o--o---o---o---o---o        "main"
                       |
                      my_tag

When you merge "main" into "arch", the "main" DAG* becomes a part of the "arch" DAG. The tag points to a specific commit, which represents a state of the DAG, which is also now part of the "arch" DAG.

The output of 'git describe $arch_branch' will likely change after you create the tag though.

Try these commands:
  git describe $main
  git describe $arch_branch
  git tag -m 'a test tag' my_tag $main
  git describe $main
  git describe $arch_branch
-brandon
* DAG - directed acyclic graph
Previous: Chris FriesenNext: Chris Friesen
Message 12 of 16 in “any way to apply tag across all branches in repository?”
  1. Chris FriesenMay 19, 2009
  2. Tomas CarneckyMay 19, 2009
  3. Chris FriesenMay 19, 2009
  4. Brandon CaseyMay 19, 2009
  5. Chris FriesenMay 19, 2009
  6. Linus TorvaldsMay 19, 2009
  7. Chris FriesenMay 19, 2009
  8. Linus TorvaldsMay 19, 2009
  9. Chris FriesenMay 19, 2009
  10. Linus TorvaldsMay 19, 2009
  11. Chris FriesenMay 19, 2009
  12. Brandon CaseyMay 19, 2009
  13. Chris FriesenMay 19, 2009
  14. Brandon CaseyMay 19, 2009
  15. Chris FriesenMay 19, 2009
  16. Brandon CaseyMay 19, 2009

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.