On Tue, Dec 11, 2012 at 10:02 AM, King Jin <jinking.t...@gmail.com> wrote:
> git submodule might be the one you are looking for.
>
> $git clone git://github.com/lei/B.git B
> $cd B
> $git submodule add git://github.com/lei/A.git kvm
> $git submodule update
>

Thanks it works for me, and if I do a 'git push', and then clone it to local
and git pull, does it update the kvm part if kvm part has update?

Lei

> anyone else cloned your repo B, just run `git submodule update` (exclude `)
> will get the commit history of repo A by changing current working directory
> to kvm and run git log.
>
> On Tue, Dec 11, 2012 at 8:49 AM, <git-users@googlegroups.com> wrote:
>>
>>   Today's Topic Summary
>>
>> Group: http://groups.google.com/group/git-users/topics
>>
>> git help about git merge to a specific dir and keep the commit log [4
>> Updates]
>>
>>  git help about git merge to a specific dir and keep the commit log
>>
>> lei yang <yanglei.f...@gmail.com> Dec 10 04:35PM +0800
>>
>> Hi experts,
>>
>> I have two tree A and B,
>> A: git://github.com/lei/A.git
>> B: git://github.com/lei/B.git
>>
>> B is like
>> [lyang0@ubuntu B]$ ls
>> benchmark box-opening kvm
>>
>> I want merge A tree to B,
>> 1) put A's content to the "kvm" directory of B
>> 2)I want to keep all the A's commit log(history) into B's tree
>>
>> can you give me some instruction? Thanks
>>
>> Lei
>>
>>
>>
>> John McKown <john.archie.mck...@gmail.com> Dec 10 06:42AM -0800
>>
>> I think this is similar to what I gave to a post a couple of days ago. You
>> might try the following on your local machine. I will show the commands
>> that I would enter in a Linux BASH shell. I don't do Windows or MacOSX,
>> but
>> you seem to be on Ubuntu.. First, I would clone the B repository into a
>> local working directory. I would then clone A into a different local
>> working directory. Of course, double check the results of all the commands
>> after doing them and stop if something goes wrong. I have not redone them
>> myself to remind myself exactly what to do. It's why I'm showing doing
>> this
>> into new subdirectories. Make sure the new B working directory is good
>> before pushing to github!
>>
>> cd ~/some-subdir #go someplace to make the new A and B working directories
>> git clone git://github.com/lei/A.git
>> git clone git://github.com/lei/B.git
>> cd A
>> git checkout -b kvm #make a new branch in A
>> mkdir kvm #make a kvm directory for A
>> git mv * kvm #move everything into it
>> git commit -m 'move to kvm subdirectory for copy to B' #Needed???
>> cd ../B #go to the B subdirectory
>> git remote add temp ../A/.git #make A's .git directory a remote here
>> git merge --no-commit temp kvm #merge in A's kvm branch
>> git commit -m 'Copy all of kvm from project A'
>> git remote rm temp #remove that temp repository
>> git push #update github.
>>
>> I think that is fairly close to what you may need. Perhaps one of the true
>> "old, wise ones" (I'm an "old, not-so-wise one") will also give you some
>> pointers.
>>
>> On Monday, December 10, 2012 2:35:58 AM UTC-6, lei yang wrote:
>>
>>
>>
>> John McKown <john.archie.mck...@gmail.com> Dec 10 08:12AM -0800
>>
>> possible mini bug, instead of:
>>
>> git mv * kvm
>>
>> use
>>
>> git mv \* kvm
>>
>> The \ in front of the * tells git to expand the file names instead of
>> having the shell do it. My mistake.
>>
>> On Monday, December 10, 2012 2:35:58 AM UTC-6, lei yang wrote:
>>
>>
>>
>> Konstantin Khomoutov <flatw...@users.sourceforge.net> Dec 10 08:30PM +0400
>>
>> On Mon, 10 Dec 2012 16:35:58 +0800
>> > 1) put A's content to the "kvm" directory of B
>> > 2)I want to keep all the A's commit log(history) into B's tree
>>
>> > can you give me some instruction? Thanks
>>
>> This is what the "add" commmand of git-subtree [1] does.
>> Note that since 1.7.11, this script is included in Git, in its
>> "contrib" directory, so it's callable from there.
>>
>> 1. https://github.com/apenwarr/git-subtree
>>
>>
>>
>> You received this message because you are subscribed to the Google Group
>> git-users.
>> You can post via email.
>> To unsubscribe from this group, send an empty message.
>> For more options, visit this group.
>>
>> --
>>
>>
>
>
> --
>
>

-- 


Reply via email to