# Submodules and branches

3 messages from 2008-04-04 to 2008-04-04. Participants: Pat Maddox, Avery Pennarun.
Thread: https://gitlist.dev/t/12985

## Pat Maddox, 2008-04-04 19:40

Subject: Submodules and branches
Message-ID: <810a540e0804041240p4efd0973g7f46a2021b352822@mail.gmail.com>
URL: https://gitlist.dev/e/810a540e0804041240p4efd0973g7f46a2021b352822%40mail.gmail.com

```
I've got a repository that uses submodules.  If I cd to the repo root
and create a branch, all the submodules are switched to that branch as
well.  All good so far.  I go into the submodules and do my work,
committing as I go along.  Then when I'm all done and want to merge
the changes into my master branch, I cd back to the repo root and do
"git merge new_topic"

That's where it breaks down.  The commits that I made go into the
master repo itself, and the submodules don't have them.  So when I
push from the submodule to its origin, nothing goes through.  The code
is now a part of the master repo.

Is it possible for me to use branches like usual, but with submodules?

Pat

```

## Avery Pennarun, 2008-04-04 20:02

Subject: Re: Submodules and branches
Message-ID: <32541b130804041302i1e32e4b3l141e8b08200a2357@mail.gmail.com>
URL: https://gitlist.dev/e/32541b130804041302i1e32e4b3l141e8b08200a2357%40mail.gmail.com
In-Reply-To: <810a540e0804041240p4efd0973g7f46a2021b352822@mail.gmail.com>

```
On 4/4/08, Pat Maddox <pergesu@gmail.com> wrote:
> I've got a repository that uses submodules.  If I cd to the repo root
>  and create a branch, all the submodules are switched to that branch as
>  well.  All good so far.  I go into the submodules and do my work,
>  committing as I go along.  Then when I'm all done and want to merge
>  the changes into my master branch, I cd back to the repo root and do
>  "git merge new_topic"
>
>  That's where it breaks down.  The commits that I made go into the
>  master repo itself, and the submodules don't have them.

There is something wrong with your story somewhere: submodules in git
each have their own, completely independent,
branching/merging/pulling/pushing etc.  What makes you think the
submodules are branching at the same time as your supermodule?

Perhaps you have accidentally committed the *files* from your
submodule into your supermodule, which means you're not using
git-submodule at all.

Have fun,

Avery

```

## Pat Maddox, 2008-04-04 20:07

Subject: Re: Submodules and branches
Message-ID: <810a540e0804041307l665442eapcb5547343358df04@mail.gmail.com>
URL: https://gitlist.dev/e/810a540e0804041307l665442eapcb5547343358df04%40mail.gmail.com
In-Reply-To: <32541b130804041302i1e32e4b3l141e8b08200a2357@mail.gmail.com>

```
On Fri, Apr 4, 2008 at 1:02 PM, Avery Pennarun <apenwarr@gmail.com> wrote:
> On 4/4/08, Pat Maddox <pergesu@gmail.com> wrote:
>  > I've got a repository that uses submodules.  If I cd to the repo root
>  >  and create a branch, all the submodules are switched to that branch as
>  >  well.  All good so far.  I go into the submodules and do my work,
>  >  committing as I go along.  Then when I'm all done and want to merge
>  >  the changes into my master branch, I cd back to the repo root and do
>  >  "git merge new_topic"
>  >
>  >  That's where it breaks down.  The commits that I made go into the
>  >  master repo itself, and the submodules don't have them.
>
>  There is something wrong with your story somewhere: submodules in git
>  each have their own, completely independent,
>  branching/merging/pulling/pushing etc.  What makes you think the
>  submodules are branching at the same time as your supermodule?
>
>  Perhaps you have accidentally committed the *files* from your
>  submodule into your supermodule, which means you're not using
>  git-submodule at all.

Hi Avery,

You're right, something was screwed up with the repo.  One of the
paths was added as a submodule, but it also had files committed to it.
 I fixed all of that up and it seems to be fine now.

Pat

```
