Skip to content

Commit 9f58b2c

Browse files
committed
make deploy script not check out any files
1 parent 376df79 commit 9f58b2c

File tree

1 file changed

+10
-5
lines changed

1 file changed

+10
-5
lines changed

deploy.sh

Lines changed: 10 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -25,13 +25,17 @@ if [[ $previous_branch = "HEAD" ]]; then
2525
previous_branch=$commit_hash
2626
fi
2727

28-
if ! ( git diff --exit-code --quiet \
29-
&& git diff --exit-code --quiet --cached ); then
30-
echo Aborting due to uncommitted changes
28+
if ! git diff --exit-code --quiet --cached; then
29+
echo Aborting due to uncommitted changes in the index
3130
exit 1
3231
fi
3332

34-
git --work-tree "$deploy_directory" checkout $deploy_branch --force
33+
#make deploy_branch the current branch
34+
git symbolic-ref HEAD refs/heads/$deploy_branch
35+
36+
#put the previously committed contents of deploy_branch branch into the index
37+
git --work-tree "$deploy_directory" reset --mixed
38+
3539
git --work-tree "$deploy_directory" add --all
3640

3741
if git --work-tree "$deploy_directory" diff --exit-code --quiet HEAD; then
@@ -43,4 +47,5 @@ else
4347
git push origin $deploy_branch
4448
fi
4549

46-
git checkout $previous_branch --force
50+
git symbolic-ref HEAD refs/heads/$previous_branch
51+
git reset --mixed

0 commit comments

Comments
 (0)