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

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