Last Updated: February 25, 2016
· diurnalist

Update git submodules when checking out branch

If you work on projects that utilize a fair amount of submodules, and want to automate the task of simply running git submodule update whenever you go back and forth between feature branches, you can utilize the git post-checkout hook:


# Update git submodules automatically when branch changes
git submodule update --init

Simply create a .git/hooks/post-commit file with the above contents.