Skip to content

Instantly share code, notes, and snippets.

@fancyremarker
Created July 25, 2012 19:37
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save fancyremarker/3178096 to your computer and use it in GitHub Desktop.
Save fancyremarker/3178096 to your computer and use it in GitHub Desktop.
Sane Git hooks for projects with submodules
#!/bin/sh
# Check if this is a branch checkout
if [ "${3}" -eq "1" ] ; then
git submodule update --init
fi
#!/bin/sh
git submodule update --init --rebase
@fancyremarker
Copy link
Author

To set up a repo with these hooks, run the following from the top-level of your repository:

curl -L https://raw.github.com/gist/3178096/post-checkout > .git/hooks/post-checkout
curl -L https://raw.github.com/gist/3178096/post-merge > .git/hooks/post-merge
chmod +x .git/hooks/post-merge .git/hooks/post-checkout

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment