I\'m developing a jQuery plugin that\'s being hosting on GitHub. It has a demo included of which I\'m manually copying and pushing to the branch gh-pages, what
I'm adding further explanation to @denbuzze and @MCSDWVL answers.
If you want to push both to master and gh-pages automatically each time you run git push origin, you probably want to add a Refspec to the git config of your repo.
So, according to the git-scm book, you can add two RefSpecs, by adding two push values to the repo config file .git/config:
[remote "origin"]
url = https://github.com//
fetch = +refs/heads/*:refs/remotes/origin/*
push = refs/heads/master:refs/heads/master
push = refs/heads/master:refs/heads/gh-pages
That will cause a git push origin to:
master branch to the remote master branchmaster branch to the remote gh-pages branchby default.
Note: using a + before the spec causes to force push to the repo. Use it with caution:
The format of the refspec is an optional
+, followed by, where: is the pattern for references on the remote side andis where those references will be written locally. The+tells Git to update the reference even if it isn’t a fast-forward.