Topic: https://brettterpstra.com/2012/09/26/github-tip-easily-sync-your-master-to-github-pages/
hide preview

What's next? verify your email address for reply notifications!

Vitor Baptista 12y, 93d ago

That's a neat tip, thanks! It got me wondering: if you want to mirror master to gh-pages, keeping them the same at all times, why bother having a master branch after all?

Usually people have the two branches because they want to control when you'll deploy to your page. But if they're always in sync, it becomes useless to have two.

GitHub lets you set your default repository to be whatever you want. Change that to gh-pages, delete master, and go. That's the solution I used for https://github.com/vitorbap....

What do you think?

hide preview

What's next? verify your email address for reply notifications!

Donald 12y, 174d ago

You still have to do the rebase manually though right? It jut automatically pushed both branches when you push one?

remark link
hide preview

What's next? verify your email address for reply notifications!

Donald 12y, 174d ago

Oh never mind I see. You want your gh-pages branch to be a mirror of your master branch.

I was thinking your gh-pages branch had some HTML/markdown in the root directory and you wanted to keep the examples directory in sync. That is what I'd like to know; how to include a subtree of the master branch in sync with the gh-pages branch.

Also in you first example you could also have committed to master branch and just done git push origin master:gh-pages which would push local master to remote gh-pages. Essentially what those two lines are doing.

Sorry tired and rambling. Cool ideas.

remark link parent
hide preview

What's next? verify your email address for reply notifications!

Brett 12y, 174d ago

On the first point, that would be awesome, but I haven't figured out how to do it without .gitignore-ing a folder and creating a submodule, and that sucks if you're using multiple branches for development. If you figure out a solid way to do it, please let me know.

Second point: learn something new every day. Especially when it comes to git. Didn't realize that it would actually mirror the ref to both; thought it just pushed both branches to their respective tracking branch. That's probably an entirely different command (--all).

hide preview

What's next? verify your email address for reply notifications!