Skip to content

Instantly share code, notes, and snippets.

@amazingandyyy
Forked from IvanWei/deploy-to-target-branch.sh
Created September 10, 2017 02:31
Show Gist options
  • Save amazingandyyy/c0d190ef3fff2e3193dddc6c2b7ad23a to your computer and use it in GitHub Desktop.
Save amazingandyyy/c0d190ef3fff2e3193dddc6c2b7ad23a to your computer and use it in GitHub Desktop.
Deploy to target branch (e.g. gh-pages)
#!/bin/bash
set -e # stop on error
echo get last commit
git pull
echo add dist folder
git add -f dist
echo commit changes
git commit -m "deploy to gh-pages"
echo push to remote target branch (gh-pages is target branch)
git push origin `git subtree split --prefix dist`:gh-pages --force
echo reset commit
git reset --hard HEAD^
echo push to develop
git push
echo All done!
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment