[tpm] [OT] Git repo combination

J. Bobby Lopez jbl at jbldata.com
Thu Jan 17 11:11:33 PST 2013


Sounds to me like you want to do a merge.

I think the only way to do it successfully in your case, is that you'd 
have to make some changes to your local repo first.

For example, lets say you have two repos.  Repo-A (yours), and Repo-B 
(the remote repo that you would like your Repo-A to reside in as a 
sub-directory).

If your Repo-A has the following layout (for example):

Repo-A:
dir1/
dir2/
dir3/
file1
file2


And the remote repo (Repo-B) has the following layout (for example):

Repo-B:
dir4/
dir5/
file3
file4


You would have to alter your local repository to modify it's layout, 
tossing everything into a sub-directory:

Repo-A becomes:

antonios-stuff/dir1/
antonios-stuff/dir2/
antonios-stuff/dir3/
antonios-stuff/file1
antonios-stuff/file2


After you commit these changes to your to your local repository 
(Repo-A), you should be able to do a merge to Repo-B without causing any 
conflicts.

The end result would be of course:


Repo-B:
dir4/
dir5/
file3
file4
antonios-stuff/dir1/
antonios-stuff/dir2/
antonios-stuff/dir3/
antonios-stuff/file1
antonios-stuff/file2

As Carlo just mentioned (as I was typing this up), git-subtree may 
provide this functionality (haven't used it myself).

Not sure if this was quite what you were looking for, but the above 
seems to me like it would work for your needs (without my knowing too 
much detail).

Hope it all works out for you.

Cheers,
-Bobby

On 13-01-17 12:12 PM, Antonio Sun wrote:
>
>
>
> On Thu, Jan 17, 2013 at 11:22 AM, Olaf Alders <olaf.alders at gmail.com 
> <mailto:olaf.alders at gmail.com>> wrote:
>
>
>     > An off-topic question on Git -- how to put my locally managed
>     Git repo under a sub-folder of another remote Git repo?
>     >
>     > My locally managed Git repo was created totally locally, without
>     any remote repo. Now I hope everything, including the histories,
>     can show up under a sub-folder of another remote Git repo.
>
>
>     Hi Antonio,
>
>     I think you want "git submodule".
>
>     http://git-scm.com/book/en/Git-Tools-Submodules
>
>
> Thanks Olaf,
>
> That's not quite what I was looking for. For git submodule, "you want 
> to be able to treat the two projects as *separate *yet still be able 
> to use one from within the other. . . Submodules allow you to keep a 
> Git repository as a subdirectory of another Git repository. This lets 
> you clone another repository into your project and keep your commits 
> separate."
>
> I wasn't able to find a remote repo for my local repo until recently, 
> now I just want to give my local repo a remote repo, but should be 
> under a sub folder. Afterward, there would be only one *combined 
> *repo. Would that be possible?
>
> Thanks
>
>
>
> _______________________________________________
> toronto-pm mailing list
> toronto-pm at pm.org
> http://mail.pm.org/mailman/listinfo/toronto-pm

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.pm.org/pipermail/toronto-pm/attachments/20130117/3e5e47f3/attachment.html>


More information about the toronto-pm mailing list