Can I make the gh-pages branch of my git repository a mirror of the Master branch?

GitHub has a Project Pages feature that pulls from the gh-pages branch of a repository. It’s explained here:

I want the gh-pages branch to be an exact mirror of the Master branch. One way I found (here on Stack Overflow) is to run:

  • Find size of git repo
  • Is there a way to lock a GIT tag?
  • Jenkins + Git Publisher - How to push back to {GIT_BRANCH}?
  • How to update topic branch with upstream changes on master?
  • `git rebase` entire branch-tree
  • How to git merge changes from main branch to orphan branch without adding to orphan's history?
  • git config --add remote.origin.push +refs/heads/master:refs/heads/gh-pages

    This causes each instance of git push to push the Master branch of the repository into the gh-pages branch.

    The trouble that I have with this solution is that I’m using the GitHub Mac App, which doesn’t use a strict git push. According to it does a git pull --rebase. Additionally, even when I select Push from the Repository menu, my git config line isn’t adhered to.

    So, I’m wondering if there is a way that fits well with the GitHub Mac App to get the gh-pages branch be an exact mirror of the Master branch.

  • Force git to run post-receive hook, even if everything is “up-to-date”
  • Beta testing new website features with live data and real customers
  • git show changes done by last 10 commits by me or anyone in a folder as a consolidated change
  • gitk <path> showing other changes in different directories in commits
  • How do you use git in “solo-development” (without team)?
  • Whoops, looks like something went wrong. error in Laravel 5 when trying to run on built in server
  • One Solution collect form web for “Can I make the gh-pages branch of my git repository a mirror of the Master branch?”

    I ran through a bunch of my own tests. It doesn’t seem like you need to go through the exact process they’ve laid out at in order to create the gh-pages branch. You can simply create a new branch named gh-pages from within the GitHub Mac App.

    They probably don’t instruct people to do this because what I’m accomplishing here isn’t a typical scenario.

    You can take these steps to create the ‘gh-pages’ branch from within the GitHub Mac App:

    1. Go to the Branches view of your repository
    2. Click the + button on your Master branch to create a new branch – name this ‘gh-pages’
    3. Click the Publish button to push it to GitHub
    4. Use the bottom left menu to checkout the Master branch, if you’re not working in the Master branch

    Take these steps to sync your changes from the Master branch into the gh-pages branch:

    1. Make changes in your Master branch
    2. In the Changes view, enter the commit summary & click the Commit & Sync button to push to the Master branch
    3. Switch to Branches view
    4. Click the Merge View button to display the Merge view
    5. Drag the Master branch to the left slot & the gh-pages branch to the right slot
    6. Click the Merge Branches button
    7. Use the bottom left menu to checkout the gh-pages branch
    8. Click the Branch in Sync button to force a synchronization
    Git Baby is a git and github fan, let's start git clone.