Skip to main content
All CollectionsAuthor HelpDropbox, GitHub and Bitbucket Syncing
How do I change the Git branch that I am using in GitHub writing mode?
How do I change the Git branch that I am using in GitHub writing mode?

Keywords: Git, GitHub, branch, change, switch, new, rename

Leanpub Support avatar
Written by Leanpub Support
Updated over 5 months ago
How do I change the Git branch that I am using in GitHub writing mode?

When you're writing a book on Leanpub using our GitHub writing mode, you can specify the branch of your GitHub repository that you want our book generators to use.

You specify which branch you want to use on the Writing Mode page for your book.

Finding the Writing Mode Page for Your Book

To change the GitHub branch for your book, go to the "Writing Mode" page for your book here:

https://leanpub.com/YOUR_BOOK/settings/writing_mode

...making sure to replace YOUR_BOOK with your book's unique web address.

You can also find the "Writing Mode" page on your book's "Overview" page:

Overview page of a Leanpub book

Changing the Branch on Your Writing Mode Page

When you are using our GitHub writing mode, your Writing Mode page will look something like this:

You can see the name of your Github repository here (in this example, the name of the repository is testbookGitHub, and we've blurred out the GitHub account name):

The branch that will be used when you create a preview is specified here:

The branch that will be used when you publish a new version is specified here:

By default, the branch is set to "main".

To change the branch you want to preview or publish from, just enter the branch name in the appropriate spot on the Writing Mode page.

Typically, authors using our GitHub writing mode like to publish from the branch named main, and preview from a different branch.

So, for example, if you want to update your book, you might create a new branch off the main branch, and name that new branch something like version2.

To preview from the version2 branch, you would enter that branch name under "Preview Branch", like this:

...and then click the "Update Book" button at the bottom of the page:

If you set your book up this way, next time you create a preview, our book generators will generate the preview based on the contents of the version2 branch of your repository.


If you have any feedback or questions about this article, please email the Leanpub team about it at hello@leanpub.com!

If you have any questions or thoughts on writing and self-publishing with Leanpub, please join our global community of authors in our Authors Forum here!

Are you interested in self-publishing, and creating your first Leanpub book? Here are some quick tutorials for our most popular writing modes: http://help.leanpub.com/en/articles/3088382-quick-walkthroughs-for-getting-started-on-a-leanpub-book

Are you looking for great deals on Leanpub ebooks, ebook bundles, and courses? Sign up for our Weekly and Monthly newsletter sales here!

To learn about amazing new books and authors, subscribe to our YouTube channel here: https://www.youtube.com/leanpub.

You can also follow Leanpub in lots of other places!

Did this answer your question?