As explained in the Site Preview conceptual guide, Stackbit shows your website's preview by cloning your site's repository and running the SSG development server. When your site's content is stored in files within your site's repository, any changes you make to your site's content via Stackbit are written back to your content files, committed, and pushed to the source repository.
To ensure that the changes you make to your site within Stackbit will not be immediately deployed and published by serverless deployment platform such as Netlify, Stackbit commits and pushes all content changes to a special
preview branch. In other words, the
preview branch stores the "unpublished" content of your site.
Likewise, if you want to make changes to your site's code and see them in the preview, you will have to make them on the
preview branch. As soon as you push new changes to the
preview branch, Stackbit will receive a GitHub commit webhook and pull your changes. If your SSG has live-reload or HMR, the preview will be updated with new changes automatically.
When you decide to publish your site via Stackbit, Stackbit merges the changes from the
preview branch to the
master branch. If you have configured your serverless deployment platform to deploy the site as soon as new commits are pushed to these branches, then publishing your site via Stackbit will also deploy your live site.
The following diagram shows the flow described above.