@@ -51,6 +51,17 @@ function set_user_id {
51
51
fi
52
52
}
53
53
54
+ function restore_head {
55
+ if [[ $previous_branch = " HEAD" ]]; then
56
+ # we weren't on any branch before, so just set HEAD back to the commit it was on
57
+ git update-ref --no-deref HEAD $commit_hash $deploy_branch
58
+ else
59
+ git symbolic-ref HEAD refs/heads/$previous_branch
60
+ fi
61
+
62
+ git reset --mixed
63
+ }
64
+
54
65
commit_title=` git log -n 1 --format=" %s" HEAD`
55
66
commit_hash=` git log -n 1 --format=" %H" HEAD`
56
67
previous_branch=` git rev-parse --abbrev-ref HEAD`
@@ -60,9 +71,9 @@ if [ $setup ]; then
60
71
git --work-tree $deploy_directory checkout --orphan $deploy_branch
61
72
git --work-tree $deploy_directory rm -r " *"
62
73
git --work-tree $deploy_directory add --all
63
- git --work-tree $deploy_directory commit -m " initial publish"
64
- git push origin $deploy_branch
65
- git symbolic-ref HEAD refs/heads/master && git reset --mixed
74
+ git --work-tree $deploy_directory commit -m " initial publish" $' \n\n ' " generated from commit $commit_hash "
75
+ git push $repo $deploy_branch
76
+ restore_head
66
77
exit
67
78
fi
68
79
@@ -104,11 +115,4 @@ case $diff in
104
115
;;
105
116
esac
106
117
107
- if [[ $previous_branch = " HEAD" ]]; then
108
- # we weren't on any branch before, so just set HEAD back to the commit it was on
109
- git update-ref --no-deref HEAD $commit_hash $deploy_branch
110
- else
111
- git symbolic-ref HEAD refs/heads/$previous_branch
112
- fi
113
-
114
- git reset --mixed
118
+ restore_head
0 commit comments