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:
#!/bin/bash
# Update git submodules automatically when branch changes
git submodule update --init
Simply create a .git/hooks/post-commit file with the above contents.
Written by Jason Anderson
Related protips
Have a fresh tip? Share with Coderwall community!
Post
Post a tip
Best
#Git
Authors
Sponsored by #native_company# — Learn More
#native_title#
#native_desc#