0

I'd like to specify a specific commit for a submodule, so whenever any mother repository is cloned with --recurse-submodules of when someone does a git pull, git submodule init and git submodule update, the version of these repositories are at a specified commit, and kept as such until someone changes said commit and pushes this change in the mother repository. I'd expect there to be something like having this content on the .gitmodules:

[submodule "my_submodule_w=that_is_broken_on_the_lastest_commit"]
    path = path/to/my/submodule
    url = ../../relative/path/to/my/submodule
    branch = master
    commit = hash_of_the_commit_where_submodule_is_compatible

Is that or anything similar possible?

Mefitico
  • 816
  • 1
  • 12
  • 41
  • 1
    "*I'd like to specify a specific commit…*" This is how submodules work; commits are written in commits of the superproject; you can see them using `git ls-tree commit_id path/to/submodule`. And this is the only way submodules work, you cannot make them work otherwise; for example, you cannot make submodules always be at the head of a branch. See https://stackoverflow.com/q/3983829/7976758 and https://stackoverflow.com/q/5033441/7976758 – phd Jul 13 '22 at 20:41
  • pointers of submodules are kept in the parent module, so I dont undertand the question. To set the submodule's commit you just need to checkout to that commit and push the pointer in the parent module. – rustyBucketBay Jul 14 '22 at 08:41

0 Answers0