4

So Eclipse's git plugin - eGit - has been supporting submodules for a while now (they added support in 1.3 release on February 15, 2012, so over a year now). I've just started to use them. I am able to add a submodule without a problem, I can create and checkout a branch inside the submodule for my local patches. I can also create a commit in the submodule.

But how do I update master repository with the pointer to the new commit? When I choose "Update submodule" it rather reverts me back to the original commit that was checked out upon adding the submodule (which isn't surprising when you think what git submodule update does). When I hit "Sync submodule" it doesn't appear to do anything at all.

So is there a way to make the master repo aware of the new commits in the submodule using eGit? I know perfectly well how to do that from the command line, but still I am trying to find out if that is possible from eGit.

Marcin Koziński
  • 10,835
  • 3
  • 47
  • 61

1 Answers1

1

Once you have modified a submodule, the Egit status done on the parent repo level should detect that this submodule has changed.
(git status, -- or gitsubmodule status implemented in JGit -- would detect any change in the submodules)

You should be able to commit, in the parent repo, even if no other files (of the parent repo) have changed, because of the "modified" state of the submodule.
That commit, recording a new SHA1 in the .gitmodules file and a special entry in the working tree, will record the new state of that submodule in the parent repo.

Community
  • 1
  • 1
VonC
  • 1,262,500
  • 529
  • 4,410
  • 5,250
  • 1
    Thank you! I had to update to eGit 2.3.1 and it works as you described. Previously I had eGit 2.2.0 and the change in the submodule didn't show in "Unstaged changes". – Marcin Koziński Apr 17 '13 at 05:07