Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Viewing changes to github pages on a specific branch

I currently have my github pages repository, b.github.io, which is forked from a.github.io. The a repository uses the master branch to publish the content of the website.

Now, I want to contribute to a via my repository, b. Because I have good faith in branch management, I wish to split my work on my fork into different branches: somebranch, another, etc.

Now, if I do changes to either of these branches, they will not reflect into my Github website (b.github.io shows the content of master, which is in sync with a.github.io). I'd need to see these changes to check if my changes work out before calling a Pull request.

How can I view the changes of the seperate branches? I tried things like b.github.io/tree/somebranch, without much success.

like image 286
Momo Avatar asked Aug 13 '16 06:08

Momo


People also ask

How do I pull changes from a branch in GitHub?

In GitHub Desktop, use the Current Branch drop-down, and select the local branch you want to update. To pull any commits from the remote branch, click Pull origin or Pull origin with rebase. Resolve any merge conflicts in your preferred way, using a text editor, the command line, or another tool.

How do I find my GitHub branch history?

Click History. On the History tab, click the commit you'd like to review. If there are multiple files in the commit, click on an individual file to see the changes made to that file in that commit.

How do you see all commits on a branch?

On GitHub.com, you can access your project history by selecting the commit button from the code tab on your project. Locally, you can use git log . The git log command enables you to display a list of all of the commits on your current branch. By default, the git log command presents a lot of information all at once.


2 Answers

Github pages uses Jekyll to render pages.

So, you can :

  • install Jekyll locally,
  • make your preview on any branch,
  • merge in master when you're happy with your changes,
  • push to b.github.io
  • make your PR to a.github.io
like image 84
David Jacquel Avatar answered Oct 19 '22 08:10

David Jacquel


I'd need to see these changes to check if my changes work out before calling a Pull request.

You should now (July 2020, 4 years later) be able to view your changes on your second repo (before doing a PR) from... any branch you want.
This is still in beta, but:

Build and deploy GitHub Pages from any branch (beta)

Repositories that use GitHub Pages can now build and deploy from any branch.

Publishing to the special gh-pages branch will still work the same as it always has, but you can now choose a different branch in your repository as the publishing source.

This functionality also removes the hardcoded dependency on user and organization pages having a master branch.

Sept. 2020: this is out of beta!

like image 30
VonC Avatar answered Oct 19 '22 09:10

VonC