Skip to content

Instantly share code, notes, and snippets.

@giorgiofellipe
Created August 11, 2014 15:19
Show Gist options
  • Save giorgiofellipe/baf9c4ed0fbd8c1cb48b to your computer and use it in GitHub Desktop.
Save giorgiofellipe/baf9c4ed0fbd8c1cb48b to your computer and use it in GitHub Desktop.
Sync MASTER branch with your GH-PAGES branch
$ git add .
$ git status // to see what changes are going to be committed
$ git commit -m 'Some descriptive commit message'
$ git push // push the master branch changes to GitHub
$ git checkout gh-pages // go to the gh-pages branch
$ git rebase master // bring gh-pages up to date with master
$ git push // push the gh-pages branch changes to GitHub Pages
$ git checkout master // return to the master branch
By rebasing, all commits on the master branch (and their commit messages) are applied to the gh-pages branch.
Using a post-commit hook # (save as .git/hooks/post-commit in your Git repo):
#!/bin/sh
git checkout gh-pages
git rebase master
git checkout master
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment