marian/git-hooks/post-rewrite
2017-03-21 18:08:33 +00:00

14 lines
431 B
Bash

#!/bin/bash
# from https://gist.github.com/digitaljhelms/f74eaf56835262d6bf3f
echo "[post rewrite hook: $1]"
# quick script to call "git submodule update" automatically if the
# .gitmodules file is changed
changedfiles=( `git diff-tree --no-commit-id --name-only HEAD@{1} HEAD` )
if [[ "${changedfiles[*]}" =~ ".gitmodules" ]]; then
echo "initializing & updating submodule(s)"
git submodule update --init --recursive
fi