On Fri, May 22, 2015 at 4:57 PM, Konstantin Khomoutov
<flatw...@users.sourceforge.net> wrote:
> On Fri, 22 May 2015 14:19:08 +0300
> Konstantin Khomoutov <flatw...@users.sourceforge.net> wrote:
>
> [...]
>> > Say we have two git repositories repoA and repoB with the following
>> > directory structure
>> >
>> > repoA
>> >  --dir1
>> >     -- dir1-1
>> >     -- dir1-3
>> >  --dir2
>> >
>> > repoB
>> >  --dir1-2
>> >
>> > I need to move the dir1-2 from repoB to repoA so that the directory
>> > structure of repoA will look like the following,
>> >
>> > repoA
>> >  --dir1
>> >     -- dir1-1
>> >     -- dir1-2
>> >     -- dir1-3
>> >  --dir2
>> >
>> > In doing so, I need to preserve the commit history for dir1-2 as
>> > well.
> [...]
>> Use the `git subtree` command [*].
> [...]
>
> To elaborate, a pseudocode (assuming a POSIX shell) is something like
> this:
>
>   $ cd repoB
>   $ git tag Bdir12 $(git subtree split dir1-2)
>
>   $ cd ../repoA
>   $ git fetch ../repoB Bdir12
>   $ git merge -s ours --no-commit Bdir12
>   $ git read-tree --prefix dir1/dir1-2 -u Bdir12
>   $ git commit --edit

Thanks for all the support rendered. I tried the above method and it
places the directory from repoB to the correct place on repoA. But if
I log the commits for dir1-2 in repoA (git log dir1/dir1-2), it shows
only the merging of the tag, not the individual commits for that
particular directory. But if I do a git log from root of repoA, it
shows all the commits. Is it possible to have the commits for dir1-2 ?


-- 
Best Regards,

Kalpa Welivitigoda
+94776509215
http://about.me/callkalpa

-- 
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