Skip to content

Instantly share code, notes, and snippets.

@kriscooke
Created April 23, 2020 18:21
Show Gist options
  • Save kriscooke/b4f3e9a2ce52fa406c48d0e5bee1cbe8 to your computer and use it in GitHub Desktop.
Save kriscooke/b4f3e9a2ce52fa406c48d0e5bee1cbe8 to your computer and use it in GitHub Desktop.
Keep Git submodules in the right state when switching branches
# https://ttboj.wordpress.com/2014/05/06/keeping-git-submodules-in-sync-with-your-branches/
# Create a file in your project's hooks: touch .git/hooks/post-checkout
# And add the following:
#!/bin/bash
exec git submodule update
# Then chmod u+x .git/hooks/post-checkout
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment