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

Re: Prepend the history of one git tree to another

From
Andreas Ericsson <ae@op5.se>
Date
Feb 20, 2006, 10:14 UTC
Message-ID
<43F99684.5070403@op5.se>
In-Reply-To
<20060220090909.GT6558@cip.informatik.uni-erlangen.de>
Thomas Glanzmann wrote:
Show 9 quoted lines
> Hello,
> I have two trees: blastwave and blastwave.old. blastwave.old is the
> BitKeeper -> CVS -> GIT Tree of the project and blastwave is the newer
> one that I started when I stoped using bitkeeper. What I want is to 
> append the history of blastwave to blastwave.old. The problem is that I
> need to create new commit objects for every commit I want to append to
> the old history. Is there a script which does that for me? Or do I have
> to write this script myself?
> 

Something like this might do the trick, depending on how linear your ancestry graph is:

$ cd blastwave $ first=$(git rev-list HEAD | tail -n 1) $ git format-patch -k --stdout $first..HEAD > ../blw.mbox $ cd ../blastwave.old $ git am -k -3 ../blw.mbox

YMMV though, so set an anchor tag at the HEAD of blastwave.old so you can return to it if things go awry. If the history is very non-linear I think you'll have to do the same for each and every branch, although you'd have to use "git merge-base" to figure out how long to go.

-- 
Andreas Ericsson                   andreas.ericsson@op5.se
OP5 AB                             www.op5.se
Tel: +46 8-230225                  Fax: +46 8-230231
Previous: Thomas GlanzmannNext: Thomas Glanzmann
Message 2 of 6 in “Prepend the history of one git tree to another”
  1. Thomas GlanzmannFeb 20, 2006
  2. Andreas EricssonFeb 20, 2006
  3. Thomas GlanzmannFeb 20, 2006
  4. Ryan AndersonFeb 20, 2006
  5. Thomas GlanzmannFeb 20, 2006
  6. Johannes SchindelinFeb 20, 2006

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.