Last active
December 22, 2019 13:51
-
-
Save sople1/b4b388614f21e1b6193d834b9afd0f9e to your computer and use it in GitHub Desktop.
GIT: post update for remote update (single server, simple ver.) 2019 checked.
This file contains hidden or 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
| #!/bin/bash | |
| # | |
| # .git/post-update | |
| # | |
| # [Simple Update Ver.] | |
| # | |
| git update-server-info | |
| echo "Starting Updating Process..." | |
| # :: Auto-Pulling script > | |
| GIT_DIR=".git" | |
| #SERVICE_WEB_ROOT="/var/www/html/" | |
| SERVICE_WEB_ROOT="/var/www/html/sample/" | |
| ORDER_WEB="cd $SERVICE_WEB_ROOT" | |
| ## switch by branch | |
| branch=$(git rev-parse --symbolic --abbrev-ref $1) # $1=refname | |
| if [ "master"=="$branch" ]; then | |
| # -- Push to WEB when Pushed branch was 'master' | |
| echo "Push to WEB>>" | |
| $ORDER_WEB | |
| git pull origin $branch | |
| else | |
| echo "None updated" | |
| fi | |
| # echo $branch | |
| # switch by branch > end | |
| echo "Updating Process Completed." | |
| # :: Auto-Pulling script > end | |
| exec |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment