質問

This is more of a methodological question regarding Git than a specific GitHub Pages question:

When I automatically generate GitHub Pages for a project I end up with gh-pages branch. However, the structure and the content of this branch bears almost no resemblance to the original master branch.

This leads me to think I completely misunderstand the notion of branches in Git. Maybe my legacy background in CVCSs can be blamed for that...

Shouldn't a branch be a copy of its origin, at least in its initial commit?

And more specific GH question: are there any simple strategies for merging gh-pages with other branches and keeping it up to date?

The latter is probably related to my previous question in Keeping GH homepage in sync with README.md.

役に立ちましたか?

解決

gh-pages are orphan branches. i.e they are completely new branches in the repository without linking to what you might consider the root, or master branch.

You can create them with:

git checkout --orphan <new-branch-name>

So there is no link to the other branches in the same repository.

他のヒント

My opinion is that the gh-pages is a trick by GitHub to allow you to create a website for the project. So the concept of branches somehow get a bit lost there.

It happened to me as well, that sometimes they end being pretty different with the original project. You may try to find trick to organize them better but don't get it confused git the general concept of branches.

Imagine, for example, a project with pre-compiled elements (SASS for example), they probably wont be included in your project, but they may be needed in the gh-pages branch.

Keeping the GH pages in sync with the README is due to this diversion between GH pages and main project, it may occur that you forget about one of them. The advice of keeping then in sync is more common sense related with keeping your project organized than anything else.

I wouldn't get worried if they don't have any resemblance.

As I said, this is only my opinion.

ライセンス: CC-BY-SA帰属
所属していません StackOverflow
scroll top