Subject: Re: combine git repo historically

From: Johannes Sixt <[email-masked]>
Date: Fri, 09 Oct 2009 08:02:44 +0200

bill lam schrieb:
> I have two git repos, no branches.
> 
> repo 1.
>   emptyrootcommit -- A ... M 
> 
> repo 2.
>   emptyrootcommit -- N ... Z
> 
> N was evolved from M but the time gap is large, how can I combine them
> into one repo
> 
> emptyrootcommit -- A ... M -- N ... Z
> 
> so that snapshots N .. Z will not be changed.

$ echo $(git rev-parse N) $(git rev-parse M) >> .git/info/grafts
$ git filter-branch --tag-name-filter cat -- --all --not M

i.e. you graft the older history right before the younger history, then
you use git filter-branch to rewrite the parentship of the younger commits.

-- Hannes