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?

有帮助吗?

解决方案

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).

许可以下: CC-BY-SA归因
不隶属于 StackOverflow
scroll top