I am working on a GIT repository (called A here). It includes a submodule (called B here). When clone a new copy of A by
git clone --recursive <repository url for A>
A and B are cloned, but the version of B is out-of-date! No matter how I updated it by
git submodule update
When I cloned only B, it is up-to-date.
What is wrong? My git version is git version 1.7.7.5 (Apple Git-26), and my repository is on bitbucket.
While inside A,
cdto dir where B is.Now you can
checkoutany commit that you want to have in A.(You may need to
fetch/pullthe latest changes before thischeckout.)Now go back to the root dir of A, and commit the change.
From now on,
git cloneorgit submodule updatewillcheckoutthat commit.Note that B is independent of A, so B can have any state in terms of branches, but as a submodule of A, it will point to the commit that A wants. This allows independent development of the two repos.