# how can I push a sub-tree

4 messages from 2009-12-17 to 2009-12-18. Participants: Zhi Li, Tay Ray Chuan.
Thread: https://gitlist.dev/t/21976

## Zhi Li, 2009-12-17 09:50

Subject: how can I push a sub-tree
Message-ID: <2986b3940912170150o17118a07i8f91e785c08e2ac9@mail.gmail.com>
URL: https://gitlist.dev/e/2986b3940912170150o17118a07i8f91e785c08e2ac9%40mail.gmail.com

```
Hi,

I tried to find a way to push a sub-tree. In section 6.7 of "Pro Git",
there's a way for pulling a git sub-tree. But I have not found the
opposite: push a git sub-tree. Can someone help me?

BTW, I appologize for not reading archives of this list.

Zhi

```

## Tay Ray Chuan, 2009-12-17 10:14

Subject: Re: how can I push a sub-tree
Message-ID: <be6fef0d0912170214u433769e3ucf8180022aa72fb3@mail.gmail.com>
URL: https://gitlist.dev/e/be6fef0d0912170214u433769e3ucf8180022aa72fb3%40mail.gmail.com
In-Reply-To: <2986b3940912170150o17118a07i8f91e785c08e2ac9@mail.gmail.com>

```
Hi,

On Thu, Dec 17, 2009 at 5:50 PM, Zhi Li <lizhi1215@gmail.com> wrote:
> I tried to find a way to push a sub-tree. In section 6.7 of "Pro Git",
> there's a way for pulling a git sub-tree. But I have not found the
> opposite: push a git sub-tree. Can someone help me?

I've not read the book, but perhaps you mean submodules?

If so, refer to the part in the git submodule tutorial that describes
how to make changes within a submodule on the GitWiki at
http://git.or.cz/gitwiki/GitSubmoduleTutorial.

-- 
Cheers,
Ray Chuan

```

## Zhi Li, 2009-12-18 00:55

Subject: Re: how can I push a sub-tree
Message-ID: <2986b3940912171655t397f90b2tf28bac3555181292@mail.gmail.com>
URL: https://gitlist.dev/e/2986b3940912171655t397f90b2tf28bac3555181292%40mail.gmail.com
In-Reply-To: <be6fef0d0912170214u433769e3ucf8180022aa72fb3@mail.gmail.com>

```
Hi,

Not sub-module, but sub-tree.

My problems are:
$ git remote add rack_remote git@github.com:schacon/rack.git
$ git fetch rack_remote
$ git branch rack_branch rack_remote/master
$ git read-tree --prefix=rack/ -u rack_branch

Now in master branch, I have a sub-tree rack. Later I modified
something in rack sub-tree. Then, how could I push my changes to
rack_remote?

Thanks
Zhi

On Thu, Dec 17, 2009 at 6:14 PM, Tay Ray Chuan <rctay89@gmail.com> wrote:
> Hi,
>
> On Thu, Dec 17, 2009 at 5:50 PM, Zhi Li <lizhi1215@gmail.com> wrote:
>> I tried to find a way to push a sub-tree. In section 6.7 of "Pro Git",
>> there's a way for pulling a git sub-tree. But I have not found the
>> opposite: push a git sub-tree. Can someone help me?
>
> I've not read the book, but perhaps you mean submodules?
>
> If so, refer to the part in the git submodule tutorial that describes
> how to make changes within a submodule on the GitWiki at
> http://git.or.cz/gitwiki/GitSubmoduleTutorial.
>
> --
> Cheers,
> Ray Chuan
>

```

## Zhi Li, 2009-12-18 02:05

Subject: Re: how can I push a sub-tree
Message-ID: <2986b3940912171805s6cbdb974u31f1b8ef5c65b7c7@mail.gmail.com>
URL: https://gitlist.dev/e/2986b3940912171805s6cbdb974u31f1b8ef5c65b7c7%40mail.gmail.com
In-Reply-To: <2986b3940912171655t397f90b2tf28bac3555181292@mail.gmail.com>

```
Hi,

I found a way to do it, but I do not know whether it is the simplest.

In master branch, run "git cat-file -p" several times to find rack
sub-tree sha. Then check-out branch "rack_branch", run "git read-tree
sha". The sha is that one just get by "git cat-file -p". Finally,
git-commit, git-push...

Cheers,
Zhi

On Fri, Dec 18, 2009 at 8:55 AM, Zhi Li <lizhi1215@gmail.com> wrote:
> Hi,
>
> Not sub-module, but sub-tree.
>
> My problems are:
> $ git remote add rack_remote git@github.com:schacon/rack.git
> $ git fetch rack_remote
> $ git branch rack_branch rack_remote/master
> $ git read-tree --prefix=rack/ -u rack_branch
>
> Now in master branch, I have a sub-tree rack. Later I modified
> something in rack sub-tree. Then, how could I push my changes to
> rack_remote?
>
> Thanks
> Zhi
>
> On Thu, Dec 17, 2009 at 6:14 PM, Tay Ray Chuan <rctay89@gmail.com> wrote:
>> Hi,
>>
>> On Thu, Dec 17, 2009 at 5:50 PM, Zhi Li <lizhi1215@gmail.com> wrote:
>>> I tried to find a way to push a sub-tree. In section 6.7 of "Pro Git",
>>> there's a way for pulling a git sub-tree. But I have not found the
>>> opposite: push a git sub-tree. Can someone help me?
>>
>> I've not read the book, but perhaps you mean submodules?
>>
>> If so, refer to the part in the git submodule tutorial that describes
>> how to make changes within a submodule on the GitWiki at
>> http://git.or.cz/gitwiki/GitSubmoduleTutorial.
>>
>> --
>> Cheers,
>> Ray Chuan
>>
>

```
