Consider a git repository Foo/, which has submodules bar1/ and bar2/.
Each of these has the same branches: 1 & 2.
I enter the supermodule, and I want to update the supermodule to contain the most recent commits from bar1 and bar2's origin. I've already init'd and updated the supermodule, so there's working trees in bar1 and bar2, but they are in a detached state. I can do the following:
cd foo;
git checkout 1
git submodule foreach git checkout 1
git pull
Now, what bugs me is repeating the branch identifier. Can I do something like "git submodule foreach git checkout $CURRENT_BRANCH_ID"? Is there a better alternative?