threads / discuss / 9466

How to work with submodule?

Subject: How to work with submodule?

## tl;dr

2 messages between Aug 10, 2007 and Aug 10, 2007.

replies: 1people: 1as markdown or json

Steffen Prohaska· Aug 10, 2007, 07:02 UTC · lore

I tried to do some work on msysgit, but instead I'm fighting with submodule for a while now. Maybe I haven't understood something, but for submodule makes git nearly unusable. Here is what I did.

msysgit ist organized in the following way.

/.git (clone of repo.or.cz/msysgit.git) /git/.git (clone of repo.or.cz/git/mingw/4msysgit.git)

That is the root of the project is msysgit and as a submodule git is included. Working on the submodule is fine.

But it I start to work on msysgit itself I get lost.

I have some changes in the submodule and just want to commit some changes in the root, rebase to origin/master and push to mob. To make it a bit harder I have some local changes in the working tree.

This sounds quite simple, but I'm fighting with submodule for quite some while now.

I think the root of all trouble is that I changed something in the submodule git and now would like to change few things in the root. I have a modified submodule and this messes up everything.

I can't stash, I can't rebase.

I tried to commit the head of the submodule (btw, how should I call this? I mean, the sha1 of the head of the submodule), to get a clean git-status.

Now, I can't even switch branches.

How is this ment to work? I have no clue how I should work with this mess?

I mean, I should be allowed to work on the submodule and somehow work on the superproject at the same time? But none of my usual workflow works because I always get trapped by a modified submodule.

	Steffen
Steffen Prohaska· Aug 10, 2007, 07:29 UTC · re: Steffen Prohaska · lore

Re: How to work with submodule?

On Aug 10, 2007, at 9:02 AM, Steffen Prohaska wrote:
> I mean, I should be allowed to work on the submodule and somehow
> work on the superproject at the same time? But none of my
> usual workflow works because I always get trapped by a
> modified submodule.

What I do now is to check with 'git diff' in the supermodule, which state of the submodule is expected. Then I bring the submodule in this state (even if this brings me to a detached head). This keeps the supermodule happy.

But if different branches of the supermodule expect different states of the submodule you may be forced to switch to another detached head after every command you run in the supermodule. There must be a simpler way, which I probably don't know.

	Steffen

← back to recent threads