File tree Expand file tree Collapse file tree 1 file changed +10
-5
lines changed Expand file tree Collapse file tree 1 file changed +10
-5
lines changed Original file line number Diff line number Diff line change @@ -25,13 +25,17 @@ if [[ $previous_branch = "HEAD" ]]; then
25
25
previous_branch=$commit_hash
26
26
fi
27
27
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
31
30
exit 1
32
31
fi
33
32
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
+
35
39
git --work-tree " $deploy_directory " add --all
36
40
37
41
if git --work-tree " $deploy_directory " diff --exit-code --quiet HEAD; then
43
47
git push origin $deploy_branch
44
48
fi
45
49
46
- git checkout $previous_branch --force
50
+ git symbolic-ref HEAD refs/heads/$previous_branch
51
+ git reset --mixed
You can’t perform that action at this time.
0 commit comments