이라 클리 아이디어에 기반을 개선하는 데 도움 주시기 바랍니다있다 여기에 내가 같이 작업 한 내용입니다 ... 내 REPO에 포스트받을
#!/bin/bash
MESSAGE=$(git log -1 HEAD --pretty=format:%s)
if [[ "$MESSAGE" == *\[staging\]* ]];
then
#action/update staging
# another method not being used...
# GIT_WORK_TREE=/path/to/working/site/ git checkout -q -f staging
echo "NOTE: Beginning Auto-Push to Staging Server... "
`git push staging`
echo "========================================================
======== Done! Pushed to STAGING.com =============
======== Thanks Captain. Keep up the good work! ========
========================================================"
elif [[ "$MESSAGE" == *\[production\]* ]];
then
#action/update production
echo "NOTE: Beginning Auto-Push to Production Server... "
# `git push production`
echo "========================================================
======== Done!!! Pushed to Production.com =======
======== Test immediately for any errors! =========
========================================================"
fi
참고 :
'git push staging'작업을 수행하려면 작업중인 트리에 .git/hooks/post-reveive 후크가 있어야합니다. 내가 'umask 002 & & git reset --hard'를 하단에 추가 한 것을 제외하고는 this code을 사용했습니다. 2
[receive]
denycurrentbranch = ignore
참고 :
나는 또한 작업 트리의 .git/config 파일에 denyrecive를 추가했다
이 설정은 작은을 위해 ... 모든 사람들에게 해당되지 않습니다 (ish) 사이트에서 빠른 & 업데이트가 문제가되지 않습니다.
(더 일관되고 쉽게 느끼기 때문에) 제안 : dev에는 하나의 _branch_, 테스트에는 하나, 프로덕션에는 하나만 사용하십시오. "테스트"를 할 때마다 훅이 테스트 환경을 업데이트해야합니다 (등등). – KingCrunch
제안 해 주셔서 감사합니다. – Irakli