Let's say I have a parent repo myproject
, and a separate repo called submodule
, with the directory structure that's the following:
root$ find . -not -path *.git* . ./myproject ./myproject/submodule
Now I add submodule
as a submodule to myproject
.
root$ cd myproject myproject$ git submodule add git://url-to-submodule:submodule.git submodule Adding existing repo at 'submodule' to the index
Now, let's say i change something to submodule
.
myproject$ cd submodule submodule$ touch herpin.txt submodule$ add herpin.txt submodule$ git commit -am "i'm herpin and i'm derpin"
At this point, I go back to the parent repository, and check the git status:
submodule$ cd .. myproject$ git status # On branch master # Changes not staged for commit: # (use "git add ..." to update what will be committed) # (use "git checkout -- ..." to discard changes in working directory) # # modified: submodule (new commits) # no changes added to commit (use "git add" and/or "git commit -a")
Well, damn it -- now each time I commit something in submodule, I also have to commit the parent.
It gets annoying pretty quickly if you have a more complex submodule tree. Let's say -- 4-levels deep. If I make a change at the inner-most submodule, I have to commit its parent, its grandparent, its great-grandparent, and its great-great-parent. That's a freaking pain in the ---.
There must be a better way! (And no, not nesting so many levels isn't an option. :/ That's not my call to make ...) Isn't there a way where git-commit can notify the parent repositories of the commit?