From 28a5378e928ef1d5431ccf6c3c93b0a7d936b9ab Mon Sep 17 00:00:00 2001 From: realaravinth Date: Sat, 16 Apr 2022 12:52:59 +0530 Subject: [PATCH] fix: create deployment branch only when it doesn't exist --- scripts/zola.sh | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/scripts/zola.sh b/scripts/zola.sh index ca52974..9dffbd0 100755 --- a/scripts/zola.sh +++ b/scripts/zola.sh @@ -97,7 +97,14 @@ deploy() { original_branch=$(git branch --show-current) tmp_dir=$(mktemp -d) cp -r $2/* $tmp_dir - git checkout --orphan $1 + + if [[ -z $(git branch --list $1) ]] + then + git checkout --orphan $1 + else + git checkout $1 + fi + git rm -rf . /bin/rm -rf * cp -r $tmp_dir/* .