Can I make git automatically update submodules when checking out a branch?
问题 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