From b7bba50a0dd2b55a58ded050b1c7f5470d3fade9 Mon Sep 17 00:00:00 2001 From: foo-dogsquared Date: Tue, 20 Aug 2019 00:26:13 +0800 Subject: [PATCH] Update the shell scripts --- deploy.sh | 9 +++++++-- first-time-setup.sh | 2 +- 2 files changed, 8 insertions(+), 3 deletions(-) diff --git a/deploy.sh b/deploy.sh index 463fc15..8a040f8 100644 --- a/deploy.sh +++ b/deploy.sh @@ -8,7 +8,7 @@ green="\u001b[32m" reset="\u001b[0m" error_log() { - printf "$red An error occurred on line $1\n" + printf "$red An error occurred on line $1\n $reset" } target_branch="gh-pages" @@ -26,6 +26,11 @@ mkdir $build_directory git worktree prune rm -rf .git/worktrees/$build_directory +# Building the worktree for the target branch +# https://git-scm.com/docs/git-worktree +echo "Checking out $target_branch branch into public" +git worktree add -B $target_branch $public $main_remote_alias/$target_branch + # Building the site printf "Building the site" hugo @@ -36,4 +41,4 @@ cd $build_directory git add --all git commit -m "Deploying site to branch $target_branch." -git push $main_remote_alias $target_branch +git push --force $main_remote_alias $target_branch diff --git a/first-time-setup.sh b/first-time-setup.sh index d6c4c17..c2bfaa2 100644 --- a/first-time-setup.sh +++ b/first-time-setup.sh @@ -30,7 +30,7 @@ git reset --hard git commit --allow-empty -m "Initializing $target_branch branch" # Pushing the branch into origin -git push $main_remote_alias $target_branch +git push --force $main_remote_alias $target_branch git checkout $default_branch # Cleaning up the build site first