1

I have 2 projects. "MyProg" and "SubProj".
Both projects are on Bitbucket.

One project is submodule to the second. The problem is that when I pull changes in the main project, the changes submodule are not pulled.

Perhaps it should be, or did I do something wrong?
How do I do that when you upgrade one project and pull the second project's change?

VonC
  • 1,262,500
  • 529
  • 4,410
  • 5,250

1 Answers1

1

The problem is that when I pull changes in the main project, the changes submodule not pull

Don't forget that a submodule is a fixed reference to a SHA1: it is a gitlink, a special entry in the index.

It doesn't move unless you have configured that submodule to follow a branch.
(See "git submodule tracking latest" and "Git submodule new version update")
In that case, this would update it:

git submodule update --init --remote

Don't forget to add, commit and push (in the parent repo) the new reference if the submodule was updated to a more recent SHA1.

Community
  • 1
  • 1
VonC
  • 1,262,500
  • 529
  • 4,410
  • 5,250
  • I do not quite understand you. my English is not very good. Can I do this? when I update the main project, I want my sub module automatically updated, too, if it was changed. – Pavel Petrashov Feb 24 '15 at 08:08
  • @PavelPetrashov follow http://stackoverflow.com/a/18799234/6309, and *then* updating your main project will include the latest of your submodule (provinding you run the command `git submodule update --recursive --remote` after `git pull`). – VonC Feb 24 '15 at 08:10
  • can you know if I can automate this in gradle? – Pavel Petrashov Feb 24 '15 at 08:38
  • @PavelPetrashov not easily: see http://stackoverflow.com/a/21374600/6309 and read more about the problem at https://jira.spring.io/browse/GRADLE-21 – VonC Feb 24 '15 at 08:40