Skip to content

Instantly share code, notes, and snippets.

@wastemobile
Created June 12, 2014 03:55
Show Gist options
  • Save wastemobile/c872cef645bbd690896a to your computer and use it in GitHub Desktop.
Save wastemobile/c872cef645bbd690896a to your computer and use it in GitHub Desktop.
嘗試讓包含 submodule 的 git repo 也能自動化部署
#!/bin/sh
#
# 這個範例
# An example hook script to update the working tree, including its
# submodules, after receiving a push.
#
# This hook requires core.worktree to be explicitly set, and
# receive.denyCurrentBranch to be set to false.
#
# To enable this hook, rename this file to "post-receive".
# Read standard input or hook will fail
while read oldrev newrev refname
do
:
done
# Unset GIT_DIR or the universe will implode
unset GIT_DIR
# Change directory to the working tree; exit on failure
cd `git config --get core.worktree` || exit
# Force checkout
git checkout --force
# Force update submodules
git submodule update --init --recursive --force
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment