1

I have a project for example called "A" and within this project, I have a folder called thirdparty which has 5 submodules: "1", "2", "3", "4", and "5".

When I tag project "A", pull it on my server, and checkout to the tag there is nothing in the thirdparty folder.

So how do I update the submodules once I have checked out to a tag?

Also is it possible to add the submodules code into the tag so it's a solid head including the submodules at the time of the tag?

António Ribeiro
  • 4,129
  • 5
  • 32
  • 49
Oliver Bayes-Shelton
  • 6,135
  • 11
  • 52
  • 88

2 Answers2

2

If you want to get the update information of submodules, you need to enter the submodule folder and treat it as a total repo. Your main project(here for you is "A") only track the commit id of submodules(here for you is "1", "2", etc).
Maybe you'll be interested in this Question. Wish it is what you want. :)
Here is a doc on submodule.
And the answer for you last question is "Yes". You can manage your main project and other projects which are submodules in your main project. Every time you update your submodule's code, you need to git add . and git commit -m "message" in your submodules' folder.
E.g. If you want to update your submodule "1"'s code:

cd A/thirdparty/1
[update your code]
git add .
git commit -a "Update message"
git push

Then back to main project "A" to commit your update for submodule.

cd ../..
git status

Here will show your project "1"'s commitid information.

git add A/thirdparty/1
git commit -m "Update submodule 1"
git push

Community
  • 1
  • 1
Kjuly
  • 34,476
  • 22
  • 104
  • 118
0

I am not sure if I really understand your question.

The normal flow to use submodule is like this:

  1. Clone the project
  2. Init the submodule
  3. Update the submodule

Will that solve your problem?

António Ribeiro
  • 4,129
  • 5
  • 32
  • 49
Enze Chi
  • 1,733
  • 17
  • 28