Managing repository pages in Github (alternative approach)

In the previous post, I went through a method that involves keeping different directories for the two branches of your code. There is another method for keeping a single directory, which is detailed below.

WARNING: This method led me down a rabbit hole of many merging conflicts. Keeping two seperate directories is MUCH better!!

Setting up a website branch

In guthub, the repository website is always read from a branch called gh-pages. The first thing you need to do to set up a repository website is to create this branch.

You can go here: to see the instructions.

In this example, we are going to make a project site, and start from scratch.

Making a new branch in the repository is the easy bit!

Setting up your repositories

We are going to follow this approach:

  1. Make changes to the master and push them
  2. First, check out the gh-pages branch
$ home/Git_projects/LSDTT_book/
$ git git checkout origin/gh-pages -b gh-pages
  1. Use the rebase function
$ git branch
* gh-pages
$ git rebase master
  1. Push the changes in master to gh-pages (so it keeps up)

WARNING: This can lead to major merging problems

I don’t really like this appraoch since it can lead to horrible merging conflicts if you don’t remember to keep rebasing every time. Also when working on windows sometimes you get a merge conflict with Thumbs.db which is very difficult to fix. I would avoid this approach.