From db1e89cd7074f77329502d422b10c71151facbab Mon Sep 17 00:00:00 2001 From: realaravinth Date: Sat, 16 Apr 2022 13:19:33 +0530 Subject: [PATCH] fix: git switch fetches remote branch if it doesn't exist on remote automatically src: https://stackoverflow.com/questions/9537392/git-fetch-remote-branch --- scripts/zola.sh | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/scripts/zola.sh b/scripts/zola.sh index 1d10272..e036eeb 100755 --- a/scripts/zola.sh +++ b/scripts/zola.sh @@ -104,8 +104,8 @@ deploy() { git checkout --orphan $1 else echo "[*] Deployment branch $1 exists, pulling changes from remote" - git pull origin $1 --force - git checkout $1 + git fetch origin $1 + git switch $1 fi git rm -rf . @@ -114,6 +114,7 @@ deploy() { git add --all if [ -n $(git status --porcelain) ]; then + echo "[*] Repository has changed, committing changes" git commit \ --author="$3" \ --message="new deploy: $(date --iso-8601=seconds)"