forked from rsdoiel/mkpage
-
Notifications
You must be signed in to change notification settings - Fork 1
/
publish.bash
executable file
·30 lines (29 loc) · 1.09 KB
/
publish.bash
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
#!/bin/bash
#
WORKING_BRANCH=$(git branch | grep "\* " | cut -d \ -f 2)
if [ "$WORKING_BRANCH" = "gh-pages" ]; then
git commit -am "publishing to gh-pages branch"
git push origin gh-pages
else
echo "You're in $WORKING_BRANCH branch"
echo "You need to pull in changes to the gh-pages branch to publish"
read -p "Pull into gh-pages and publish? Y/N " YES_NO
if [ "$YES_NO" = "Y" ] || [ "$YES_NO" = "y" ]; then
echo "Committing and pushing to $WORKING_BRANCH"
git commit -am "commiting to $WORKING_BRANCH"
git push origin "$WORKING_BRANCH"
echo "Changing branchs from $WORKING_BRANCH to gh-pages"
git checkout gh-pages
echo "Merging changes from origin gh-pages"
git pull origin gh-pages
git commit -am "merging origin gh-pages"
echo "Pulling changes from $WORKING_BRANCH info gh-pages"
git pull origin "$WORKING_BRANCH"
echo "Merging changes from $WORKING_BRANCH"
git commit -am "merging $WORKING_BRANCH with gh-pages"
echo "Pushing changes up and publishing"
git push origin gh-pages
echo "Changing back to your working branch $WORKING_BRANCH"
git checkout "$WORKING_BRANCH"
fi
fi