Question

I want to checkout a specific past commit of a git repository, let's say its hash is 'a1bc2def3':

git checkout a1bc2def3

The git repository makes heavy use of submodules. As their latest version is incompatible with the old commit, I want to checkout the latest commit of each submodule at the time of the local commit 'a1bc2def3'.

Do you know if there is a way to achieve that?

Was it helpful?

Solution

All you have to do is to run

git submodule update

after your checkout operation in the superproject.

Your subprojects (submodules) will then be checked out to the commit they were at when your superproject commit was created (they one that you have just check out with e.g. git checkout a1bc2def3).

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top