1

I need help when cloning my github repo with its submodules.
I am currently using this generic command :

git clone --recursive ${GIT_SOURCE} -b master ${MY_DIR}

and it works fine.

However, I was wondering if cloning my master branch by HASH will include the submodules "snapshot" (i.e. their own commits corresponding to that particular master commit) or their updated ones if i ever make one "on the road".

Is it possible to achieve this kind of result?

VonC
  • 1,262,500
  • 529
  • 4,410
  • 5,250
user2457613
  • 61
  • 1
  • 6

1 Answers1

0

The SHA1 of a submodule repo will always be the one recorded in the gitlink entry of the parent repo index.

However, you can configure a submodule to follow a branch of its own remote repo, which means it can be updated to its latest origin/master (if you want to follow master).

You would then need to add, after the git clone:

git submodule update --recursive --remote

That would update the submodules content to the last fetched SHA1 of their respective remote repos.


Once cloned and updated, a program like git-archive-all can generate a tarball snapshot of all the repo (including its submodules)

Community
  • 1
  • 1
VonC
  • 1,262,500
  • 529
  • 4,410
  • 5,250
  • ok, thank you. In addition to this, is there a chance now to generate a tarball snapshot with submodules included or is this feature still missing ? – user2457613 Nov 27 '14 at 10:40