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

Re: Move tags to branch

From
Brad King <brad.king@kitware.com>
Date
Oct 5, 2010, 17:29 UTC
Message-ID
<4CAB6072.2060407@kitware.com>
In-Reply-To
<m3mxqtfnrk.fsf@localhost.localdomain>
On 10/04/2010 09:10 PM, Jakub Narebski wrote:
Show 8 quoted lines
> Mathieu Malaterre <mathieu.malaterre@gmail.com> writes:
> 
>>   I have been using svn2git to start using git. However svn2git
>> creates tags from HEAD instead of the branch. Is there a way to move
>> tags back to the branch ?
> 
> Isn't it by a chance caused by the fact that Subversion does not
> "enforce" tags to not change?

I've converted repositories with this problem before. Subversion "tags" are basically branches. I usually manufacture a merge commit to keep the tagged versions alive in history as close to inline as possible. For example, if the conversion result is

                      o----v2
                     /
  ...o----B----o----o----C----D  master
      \
       o----v1

because "tags" v1 and v2 have had a couple of commits, I manually convert it to

                        o----v2
                       /      \
  ...o----B--B'--o----o----C---C'---D  master
      \      /
       o----v1
using git plumbing, grafts, and filter-branch.

B' has B as its first parent, v1 as its second parent, and the same tree object as B. Similarly for C', C, and v2. The commit messages for B' and C' explain that they were manufactured retroactively during conversion.

Commits B and C were selected as the artificial "merge points" by finding the newest commits in a first-parent traversal of master that were not newer than v1 and v2, respectively. The committer times for B' and C' are taken from v1 and v2 (or a time shortly thereafter).

-Brad
Previous: Jakub Narebski
Message 4 of 4 in “Move tags to branch”
  1. Mathieu MalaterreOct 4, 2010
  2. Jonathan NiederOct 4, 2010
  3. Jakub NarebskiOct 5, 2010
  4. Brad KingOct 5, 2010

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.