0

I have the following project structure Parent, Parent/client, Parent/server, Parent/app

client,server and app are git submodules of parent. I checkout version 1 for example of parent, go into submodule client and do git log and see commits past the date of version 1 of parent.Why?

When I commit parent, does it not take the current versions of all submodules enabling a snapshot of the entire project?

user2312688
  • 521
  • 7
  • 17

2 Answers2

0

When I commit parent, does it not take the current versions of all submodules enabling a snapshot of the entire project?

no , submodulesare standalone project bu their own.

Any changes made on submodules has to be commited in the submodule folder and the parent folder cant see it.

If you want to be able to do it like you asking you need to use subtree instead.

CodeWizard
  • 128,036
  • 21
  • 144
  • 167
  • I committed changes in submodule projects first, then committed parent project – user2312688 Apr 29 '16 at 13:03
  • Make no difference, you have to update the submodule would need to be updated, `git submodule update`. The parent doesn't care about the submodule current code. – CodeWizard Apr 29 '16 at 13:05
  • ok, i see what you mean-i was looking for a way to have version 1 of parent which could contain v1.2.3 of client, v1.3.6 of server etc and version 2 of parent would contain v1.4.2 of client etc so that i could checkout version 1 of parent and have the correct versions of client, server and app. – user2312688 Apr 29 '16 at 13:12
  • Exactly, this is the use case of cubmodules – CodeWizard Apr 29 '16 at 13:13
  • So I can use git submodules for this?or use subtree – user2312688 Apr 29 '16 at 13:19
  • Read this to decide what you want: http://stackoverflow.com/questions/36236484/maintaining-git-repo-inside-another-git-repo/36250858#36250858 – CodeWizard Apr 29 '16 at 13:23
0

I never used git submodule update to check out commits in submodules! D'oh!

user2312688
  • 521
  • 7
  • 17