On Thursday, 16 October 2014 11:42:01 UTC+2, Konstantin Khomoutov wrote:
> On Tue, 14 Oct 2014 08:11:04 -0700 (PDT) 
> Richard Kennaway <richard....@gmail.com <javascript:>> wrote: 
> > I have a set of about a dozen git repositories, side by side in the 
> > same folder. But they aren't separate projects, conceptually they're 
> > one project. 
> > 
> > This is an obviously insane arrangement, but never mind how it got 
> > like that, it is like that. I would like move from the current state, 
> > which is a directory Z containing repositories A, B, C, D, to having 
> > a git repository Z, containing directories A, B, C, D. 
> You can use `git subtree add` to achieve this. 
> It's a part of Git since, IIRC, 1.8.x or something. 
> The basic idea is this: 
> 1) Pick a "mainline" branch (the one you'd like to integrate) 
>    in each of your A ... D repos.  For simplicity, let it be "master". 
> 2) Then in your master repository, you do: 
>    git fetch url_of_repo_A master:masterA 
>    git subtree add dirA masterA 
>    git branch -D masterA 
> 3) Repeat for the rest of the repositories. 
> In the end you will have 4 new commits on the current branch of your 
> master repository which merge histories of those integrated branches 
> from imported repos. 
> Obviously, before those merge commits the histories of the master and 
> imported repositories will be disjoint but it's better than any manual 
> approach of "stitching" histories. 

Awesome. Learn something new everyday... I couldn't find any man page about 
git-subtree either locally (v2.1.2) or on git-scm (am I the only one?) 
though; so for those looking for infos on that command like me you can 
check out this raw man page from the contrib folder 
and this article <https://hpc.uni.lu/blog/2014/understanding-git-subtree/>.

You received this message because you are subscribed to the Google Groups "Git 
for human beings" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to git-users+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to