简体   繁体   中英

Git Post-Update Hook - Can I handle “master” and “branches”?

I have a post-update hook in a repo that looks like:

#!/bin/sh
echo
echo "**** Pulling changes into Live [Hub's post-update hook]"
echo

cd DIR || exit
unset GIT_DIR
git pull hub master
exec git-update-server-info

Is it possible for me to add conditions to this? I want to have it push to one directory if its a master push and another if its a branch that has been pushed?

Is this possible?

看起来有可能根据传递给更新后的内容获取分支信息:

BRANCH=$(git rev-parse --symbolic --abbrev-ref $1)

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM