Branches
Which branch your site publishes from, how to change it, and how to use feature branches, pull requests and previews for review.
Actualizado el 19 nov 20263 min de lectura
Your site publishes from one branch of your repository, the deployment branch. Pushes to that branch rebuild your site, and saves in the Typemark editor are pushed to it. Pushes to other branches never change your live site. On Pro and Enterprise, a pull request into the deployment branch gets a preview, and you can work on other branches in the editor.
Your deployment branch
When you connect a repository, the deployment branch starts as the repository's default branch on GitHub, whether that's main, master or something else. You can pick another branch before you click Connect: the list has every branch of the repository, and you can type to find one. Settings > GitHub shows the branch under Publishes from.
The Typemark editor commits to the deployment branch, unless you switch to a branch in the editor.
Changing it
The project owner can move the site to another branch at any time:
Choose the branch
In Settings > GitHub, click Change branch and pick a branch from the list. Branches marked Protected have protection rules on GitHub.
Confirm
Click Switch branch and confirm. Typemark checks that the branch exists and has a
typemark.jsonat its root, then switches in the background.
When it switches, Typemark:
- Pushes any saves that haven't reached GitHub yet to the old branch, so nothing is left behind. If GitHub won't take them there (the branch is protected or was deleted), they go to a new branch named
typemark/unpushed-<date and time>, and the deployment says so. - Rebuilds your whole site from the new branch. Readers get the pages on the new branch, and pages that only exist on the old one come off the site. A different
docs_rooton the new branch is picked up too. - Pushes editor saves to the new branch from then on, and rebuilds when you push to it.
The switch publishes the new branch straight away, even if you publish manually. It shows under Deployments as Switch to branch followed by the branch name; if it couldn't happen, the reason is there and your site stays on the old branch.
Your site can't switch to a branch that:
- doesn't exist on GitHub, or has no
typemark.jsonat the repository root (or one that isn't valid JSON); - uses Git submodules, or is over 100 MB;
- is open as a branch in the Typemark editor. Delete it there first.
Review changes with pull requests
Feature branches don't change your live site, so you can use them for drafts and review:
Create a branch
git checkout -b docs/auth-guideCommit and push
git add guides/authentication.mdx git commit -m "docs: add authentication guide" git push origin docs/auth-guideYour live site doesn't change.
Open a pull request
Open a pull request into the deployment branch and get it reviewed on GitHub. On Pro and Enterprise, Typemark builds a preview of the site with your changes and comments on the pull request with its link.
Merge
Merging pushes to the deployment branch, and Typemark rebuilds your site.
You can do the same without leaving Typemark: create a branch in the editor, and open the pull request from there. See Branches in the editor.
Projects without GitHub
A project that isn't connected to GitHub publishes from one branch, with nothing to configure. Every save in the editor commits to it, unless you work on a branch in the editor and merge it when it's ready.