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

Re: Stitching together two split segments from svn

From
Jakub Narebski <jnareb@gmail.com>
Date
Jul 24, 2008, 23:48 UTC
Message-ID
<m3ljzqvo6i.fsf@localhost.localdomain>
In-Reply-To
<654935030807241633g763e622br4feb8b4e23ee64e2@mail.gmail.com>
"Liam Healy" <lnp@healy.washington.dc.us> writes:
Show 40 quoted lines
> I have a project whose history is stored in two separate svn
> repositories.  The first repository I kept privately during initial
> development, the second started when I posted it publicly and does not
> have the history of the first.  I am trying to reunite them under git.
>  The development of the first was linear, so after using git svn, the
> history looks like:
> 
>  a - b - ... - c - d = HEAD (old repository)
> 
> and the second has one branch "ffa":
> 
> (new repository)
>  T - d - e - ... - f - g - h - ... - j   master
>                       \
>                        k - l - .... - m  ffa
> 
> Note that T is the "trunk" initial commit on the svn repo that has no
> files.  The second commit d is identical to the HEAD of old, as
> verified by git diff.
> However, when I remote add these two into a single repository, they
> show up as two detached chains, with no connection between them.  I
> thought git rebase would reconnect them.  However, when I do that on
> each branch (master and ffa), I get the following:
> 
>  a - b - ... - c - d - e - ... - f - g - h - ... - j   master
>                       \
>                        e - ... -f - g - k - l - .... - m  ffa
> 
> instead of what I would like
> 
>  a - b - ... - c - d - e - ... - f - g - h - ... - j   master
>                                      \
>                                       k - l - .... - m  ffa
> 
> That is to say, those commits from the new repository that have a
> common history for the two branches are duplicated.  The commits are
> listed separately and have different SHA IDs, but they are clearly the
> same commits (same comments, same svn version number).  Is there any
> way to do what I want?  Really, all I want to do is change the parent
> of "e" to be the HEAD of the old repository.

If this is initial import, and not published anywhere, the simplest (I think) solution would be to use grafts file (.git/info/grafts) to change parent of 'k' from 'g' in ffa to 'g' in master, by adding the line with:

  <sha1 of 'k'> <sha1 of 'g' on master>

to .git/info/grafts. Then examine history if everything is now all right (for example using gitk), and if everything is O.K. run git-filter-branch.

See documentation for details.
-- 
Jakub Narebski
Poland
ShadeHawk on #git
Previous: Liam HealyNext: Liam Healy
Message 2 of 4 in “Stitching together two split segments from svn”
  1. Liam HealyJul 24, 2008
  2. Jakub NarebskiJul 24, 2008
  3. Liam HealyJul 25, 2008
  4. Jakub NarebskiJul 25, 2008

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.