I'm working on a git repository with some submodules, which have different revisions on different branches. When I switch branches, I get a:
M path/to/subrepo
Switched to branch 'another-branch'
message. I then manually do:
git submodule update --recursive
and that goes away.
I tried writing a git hook, in .git/hooks/post-checkout:
#!/bin/bash
exec git submodules update --recursive
but this doesn't seem to do anything. I tried to add an exec echo hello from post-hook line - doesn't seem to work either.
My question: Can I configure git so that the branch checkout itself will also update the submodules, by default?