I would like to find out the current commit id of a submodule. I've found this answer about current commit id of specified submodule It suggests this code:
git rev-parse @:./yourSubmodule
It works, but if I update the submodule, it still gives me the old commit id:
git submodule update --remote --merge
git rev-parse @:./yourSubmodule
git submodule status
gives me the correct commit id, but the result is not just the commit id, but some auxiliary informations as well:
git submodule status | grep yourSubmodule
Result:
+1b2377f523dca6fa0c49bd7fa56eeb32011774e1 yourSubmodule (remotes/origin/HEAD)
What is the correct way, to determine the current commit id of a submodule? Only the commit id is needed, nothing else.