Skip to content

Instantly share code, notes, and snippets.

@IvanWei
Last active September 11, 2017 03:31
Show Gist options
  • Save IvanWei/028aeb1222d91551c82beaaf23909e0d to your computer and use it in GitHub Desktop.
Save IvanWei/028aeb1222d91551c82beaaf23909e0d 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!
@amazingandyyy
Copy link

ahha thx for sharing ;)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment