Skip to content

Instantly share code, notes, and snippets.

@bradneuman
Last active February 17, 2016 19:20
Show Gist options
  • Save bradneuman/bbcb6558d01873ea6842 to your computer and use it in GitHub Desktop.
Save bradneuman/bbcb6558d01873ea6842 to your computer and use it in GitHub Desktop.
A git hook to automatically populate submodule summary information
#!/bin/sh
# prepare-commit-msg hook that puts the relevant `submodule summary` info in the commit log for you
# automaticially. Put it in .git/hooks/prepare-commit-msg (and make sure it is executable)
TEMP=`mktemp /tmp/commit.XXXX`
echo "\n\n" > $TEMP
# remove the * at the beginning of the line so github doesn't think we are making a list
git submodule summary --cached | sed 's/^* //' | cat - $1 >> $TEMP && mv $TEMP $1
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment