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

Re: git svn project shuffle

From
Jonathan Nieder <jrnieder@gmail.com>
Date
Oct 4, 2010, 18:54 UTC
Message-ID
<20101004185424.GA6343@burratino>
In-Reply-To
<AANLkTimL18WHOrLjA5iWNcsgd6H8Eeq19LfJNjkKu_b-@mail.gmail.com>
Hi Chris,
Christopher Snapp wrote:
Show 5 quoted lines
> # If I try to start from scratch by using git svn clone --stdlayout
> the "newproj" location I lose all of the revision history associated
> with "oldproj/trunk" that has been copied to newproj/trunk/oldproj.
> How can I have git understand the history for the
> newproj/trunk/oldproj location?
If I were in your situation I would do the following:
 0. Make backups!
 1. git svn init -Rnew ...newproj info...
 2. Edit .git/config to put the new project in a separate
     refs/remotes/newproj/ hierarchy.
 3. git svn -Rnew fetch
 4. gitk --all.  Look around.
 5. For each "tip" of the old history:
     git replace <corresponding new commit> <old branch tip>
 6. gitk --all.  Make sure it looks right.
 7. git filter-branch -- --all
 8. rm -fr .git/svn.  This is destructive, but only of information
    you're probably not using.  (It forgets old properties, for
    example.)
 9. Edit .git/config and use "git branch -r -d" to get rid of references
    to oldproj.  Rename the newproj svn-remote to "svn" again.
10. git svn fetch.
11. gitk --all.  Everything good?  Push.
> # An alternative would be if I could somehow reconfigure my already
> checked out oldproj git repo so I retain all of the version history
> and my local branches and can move forward checking code into the
> newproj/trunk/oldproj location?

If your history in each branch is not published and is linear, you could also try just putting the old and new histories in one temporary repo and rebasing your private branches.

Or you can export your own work with "git format-patch" or "git fast-export" and reimport it with "git am" or "git fast-import".

Hope that helps, Jonathan

Previous: Christopher SnappNext: Christopher Snapp
Message 2 of 4 in “git svn project shuffle”
  1. Christopher SnappOct 4, 2010
  2. Jonathan NiederOct 4, 2010
  3. Christopher SnappOct 13, 2010
  4. Jonathan NiederOct 15, 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.