Вопрос

I need to create in a Git Repository a submodule that refers to another Repo that is in constant develop, but I need to refers to a particular commit in that other Repo. I manage to create a submodule by using:

git submodule add url otherRepo

But I don't know how can I refer to a particular commit in the otherRepo submodule. Does any one knows how can I manage to do it? Once done this when I clone the repositoty I want that the submodule state in the previously specified commit. Thanks

Это было полезно?

Решение

According to this resource, submodule is tracked by specific commit that you have checked out in submodule repo. So simply git checkout commit you want to have inside submodule directory and be it should be working as intended.

Git diff after checkout seems to confirm this with results like:

-Subproject commit 9fc330b3280fa7ec443f1b32e2943d38ba018f73
+Subproject commit 8b958758994216f2e7ee5ffbf5d2a3fc483e1ad5
Лицензировано под: CC-BY-SA с атрибуция
Не связан с StackOverflow
scroll top