Last active
September 7, 2015 03:49
-
-
Save leiming/fe5e44085f40d6d23baf to your computer and use it in GitHub Desktop.
git-hoots/ 执行 checkout 至特定分支时,执行特定脚本
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env bash | |
# | |
# Copyright (c) 2015 GAME_TEAM. | |
# | |
# ------------------------------------------------- | |
# File: post-checkout | |
# Location: $GIT_ROOT/.git/hooks/ | |
# Doc: http://git-scm.com/docs/githooks | |
# Usage: | |
# cd $GIT_ROOT | |
# checkout dev-toolbar | |
# ------------------------------------------------- | |
TARGET_BRANCH='dev-toolbar' | |
CURRENT_BRANCH=`git rev-parse --abbrev-ref HEAD` | |
ROOT_DIR=`git rev-parse --show-toplevel` | |
# 当 checkout 至目标分支时, 执行特定脚本 | |
if [[ "$TARGET_BRANCH" = "$CURRENT_BRANCH" ]]; then | |
sh $ROOT_DIR/deploy.sh | |
fi |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment