If you’re new to git and GitHub, start with the Overview to understand the benefits of this feature, then skip to New to GitHub for a brief introduction to key terminology and patterns.

Overview

Connecting to GitHub backs up your code, with full version history.

It means you’re not locked in to Bolt: you can work in Bolt for as long as you want, go work directly in your repository, then return to Bolt when you’re ready. Having your work in GitHub means you can now deploy your site to other services, rather than being locked in to Bolt’s Netlify integration.

Bolt’s GitHub integration aims to:

  • Minimize complexity, providing a simplified wrapper around git.
  • Maintain clear distinctions between branches: Bolt’s agent memory is scoped to the active branch, meaning it only sees and builds on messages from that branch. There’s no risk of context leaking between branches.
  • Give you full control: you choose which projects connect to a repository.

Connect GitHub

You can import an existing GitHub repository into Bolt, or start from a new Bolt project and create a new repository in GitHub.

Prerequisites

You need an individual GitHub account. Bolt doesn’t currently support GitHub organization accounts.

Create a new repository from a Bolt project

To create a repository from your Bolt project:

  1. Select Integrations > GitHub.
  2. If it’s your first time connecting, Bolt displays a dialog to connect your accounts. Select Log in to GitHub. A new tab opens. Follow the steps to authorize StackBlitz.
  3. Enter a name for the repository.
  4. Select Create repository. Bolt creates new private repository, and displays a confirmation saying Connected to GitHub.
  5. Close the dialog to return to your project.

The repository starts as private, and on the main branch. You can set the repository to public in your GitHub settings, and you can create new branches in Bolt or on GitHub. See Branching and merging for more information.

Import an existing repository

You can import an existing repository into Bolt on the Bolt homepage:

  1. Select GitHub.
  2. If it’s your first time connecting, Bolt displays a dialog to connect your accounts. Select Log in to GitHub. A new tab opens. Follow the steps to authorize StackBlitz.
  3. Choose the repository you want to import.
  4. Select Choose this repository. Bolt loads the project. You start on the main branch.

Disconnect GitHub

To remove the GitHub integration:

  1. In GitHub, go to Settings > Applications > Authorized OAuth Apps.
  2. Select the menu on the StackBlitz app.
  3. Select Revoke. GitHub asks you to confirm. Select I understand, revoke access to proceed.
  4. If you signed up for Bolt using your GitHub account, this is all you need to do. If you used another signup method for Bolt, you can remove your GitHub details from your StackBlitz account:
    1. Log in to StackBlitz.
    2. Go to Settings > Credentials.
    3. Next to the GitHub connection, select Delete.
    4. If you use different emails for StackBlitz and GitHub, go to Settings > Profile to delete the GitHub email.

Git behavior

Bolt aims to minimize the complexity of git.

Branching and merging

When you create a new repository from Bolt, or import an existing repository, you start on the main branch. You can create new branches in Bolt, and you can use other branches that you create in GitHub.

To create a new branch in Bolt:

  1. In your project, select the GitHub icon.
  2. Select Create new branch.
  3. Enter a branch name.
  4. Select Create branch. Bolt created the new branch in GitHub. You’re now working on your new branch.

To change branches:

  1. In your project, select the GitHub icon.
  2. Select the branch you want to switch to.

Merging branches isn’t available in Bolt yet. You need to do this in GitHub.

Committing and fetching

  • Bolt auto-commits every change that doesn’t have a runtime error.
  • Bolt also auto-updates with external commits, by polling for changes every 30 seconds.
There is a small risk of a race condition, where you make a change in Bolt, but a change also occurs in GitHub before the auto-commit completes. In this case, Bolt resolves any conflicts by accepting the Bolt changes and overwriting the changes on GitHub.

New to GitHub

If you’re completely new to GitHub, here’s what you need to know to use it with Bolt.

GitHub is the most popular tool for storing and collaborating on code projects. It uses a version control software called git. You don’t need detailed knowledge of how git works to use GitHub with Bolt.

Key terms:

  • Repository: a project.
  • Branch: a version of the project. You can have multiple branches in one project.
  • Merge: combine two branches into one.

When you create a new repository from your Bolt project, it has just one branch, called main. Usually, main is the branch with the live version of your project. You can do all your work on main, or start using branches.

When to use branches:

  • If more than one person is working on the project, branches avoid clashes such as both people trying to change the same thing and overwriting each other’s work.
  • You can use branches to work on different features simultaneously, without risking setting unfinished work live. For example, if you just use main, and you’re working on three different features at once, you have to finish all of them before publishing the project (or risk setting incomplete or broken work live). If you do each piece of work on a separate branch, you can merge each one into main when they’re ready.

Resources to learn more about git and GitHub: