> ## Documentation Index
> Fetch the complete documentation index at: https://docs.rocket.new/llms.txt
> Use this file to discover all available pages before exploring further.

# Code sync

> Connect GitHub code sync to your Rocket.new app: two-way sync for Next.js TypeScript projects.

export const LlmsDirective = () => <blockquote className="llms-directive">
    For the complete documentation index, see <a href="/llms.txt">llms.txt</a>.
    For a lightweight markdown version of this page, append .md to the URL.
  </blockquote>;

<LlmsDirective />

For Next.js TypeScript projects, Rocket supports full two-way sync with GitHub. Rocket pushes changes to a `rocket-update` branch and automatically opens a pull request to `main` for each batch of code edits. Pull changes made by teammates or in your local IDE back into Rocket at any time.

<Note>
  Code sync requires a paid plan (Pro or above).
</Note>

For all other frameworks, sync is one-way (push only). You need to manually click **Push** when you want to update GitHub. No automatic PR is created.

<Divider />

## How it works

| Direction                   | What happens                                                                                                     | Supported projects      |
| :-------------------------- | :--------------------------------------------------------------------------------------------------------------- | :---------------------- |
| **Push** (Rocket to GitHub) | Rocket pushes changes to the `rocket-update` branch and automatically opens a pull request to `main` for review. | Next.js TypeScript only |
| **Push** (Rocket to GitHub) | Push your code to GitHub manually. No automatic pull request is created.                                         | All other frameworks    |
| **Pull** (GitHub to Rocket) | Imports the latest state of `main` back into your Rocket project, with conflict resolution if needed.            | Next.js TypeScript only |

<Divider />

## Push to GitHub

<Steps>
  <Step title="Click the GitHub icon">
    Click the **GitHub** icon in the toolbar.
  </Step>

  <Step title="Push">
    Click **Push** to send your project code to GitHub. Rocket automatically creates a repository for you. For **Next.js TypeScript** projects, Rocket pushes to the `rocket-update` branch and automatically opens a pull request to `main` so your changes can be reviewed. For all other frameworks, the code is pushed but no automatic PR is created. Push again anytime to update with your latest changes.

    <Frame caption="Push to GitHub">
      <img src="https://mintcdn.com/dhiwisepvtltd-5e04e6a4/-yEl0B9S0cPv2W9c/images/build-docs/connectors/github/web-browser/github-push-light.webp?fit=max&auto=format&n=-yEl0B9S0cPv2W9c&q=85&s=a62f5072fa676e49ea40ba652e42d777" alt="GitHub push dialog showing repository selection and Push button." className="theme-image light-image" width="2880" height="1624" data-path="images/build-docs/connectors/github/web-browser/github-push-light.webp" />

      <img src="https://mintcdn.com/dhiwisepvtltd-5e04e6a4/-yEl0B9S0cPv2W9c/images/build-docs/connectors/github/web-browser/github-push-dark.webp?fit=max&auto=format&n=-yEl0B9S0cPv2W9c&q=85&s=246fb9245f6194d4659e7d11777c64f4" alt="GitHub push dialog showing repository selection and Push button." className="theme-image dark-image" width="2880" height="1624" data-path="images/build-docs/connectors/github/web-browser/github-push-dark.webp" />
    </Frame>
  </Step>
</Steps>

<Divider />

## Pull from GitHub

Available for Next.js TypeScript projects only. After your initial push, the GitHub button changes to **Pull from GitHub**.

<Steps>
  <Step title="Click Pull from GitHub">
    Click the **Pull from GitHub** button in the toolbar.

    <Frame caption="Pull from GitHub">
      <img src="https://mintcdn.com/dhiwisepvtltd-5e04e6a4/-yEl0B9S0cPv2W9c/images/build-docs/connectors/github/web-browser/github-pull-light.webp?fit=max&auto=format&n=-yEl0B9S0cPv2W9c&q=85&s=d0c42d0eafbdfeb138a6edf622d759ac" alt="GitHub pull dialog showing Pull from GitHub button." className="theme-image light-image" width="2880" height="1624" data-path="images/build-docs/connectors/github/web-browser/github-pull-light.webp" />

      <img src="https://mintcdn.com/dhiwisepvtltd-5e04e6a4/-yEl0B9S0cPv2W9c/images/build-docs/connectors/github/web-browser/github-pull-dark.webp?fit=max&auto=format&n=-yEl0B9S0cPv2W9c&q=85&s=61f3d6335b52db1a49b7bad60149a514" alt="GitHub pull dialog showing Pull from GitHub button." className="theme-image dark-image" width="2880" height="1624" data-path="images/build-docs/connectors/github/web-browser/github-pull-dark.webp" />
    </Frame>
  </Step>

  <Step title="Resolve any conflicts">
    If there are no conflicts, the pull completes immediately and you see a success message with no further steps needed.

    If changes in GitHub conflict with your Rocket project, Rocket surfaces them so you can choose how to resolve before the pull completes.

    <Frame caption="Conflict resolution during pull">
      <img src="https://mintcdn.com/dhiwisepvtltd-5e04e6a4/-yEl0B9S0cPv2W9c/images/build-docs/connectors/github/web-browser/rocket-github-pull-light.webp?fit=max&auto=format&n=-yEl0B9S0cPv2W9c&q=85&s=90d0bbd5d437294d614cdcfd967b315a" alt="Rocket showing conflict resolution options during a GitHub pull." className="theme-image light-image" width="2880" height="1624" data-path="images/build-docs/connectors/github/web-browser/rocket-github-pull-light.webp" />

      <img src="https://mintcdn.com/dhiwisepvtltd-5e04e6a4/-yEl0B9S0cPv2W9c/images/build-docs/connectors/github/web-browser/rocket-github-pull-dark.webp?fit=max&auto=format&n=-yEl0B9S0cPv2W9c&q=85&s=297ca68343e2255ad79aa2f780e8c9f3" alt="Rocket showing conflict resolution options during a GitHub pull." className="theme-image dark-image" width="2880" height="1624" data-path="images/build-docs/connectors/github/web-browser/rocket-github-pull-dark.webp" />
    </Frame>
  </Step>

  <Step title="Continue building">
    Once the pull is complete, your preview updates automatically and you can keep iterating.
  </Step>
</Steps>

<Note>
  For Rocket-generated apps, pulls are from the `main` branch only. For cloned repositories, Rocket pulls from the branch you selected when cloning. Changes on other branches will not be pulled into Rocket.
</Note>

<Divider />

## When to push vs pull

| Scenario                                               | Action                                      |
| :----------------------------------------------------- | :------------------------------------------ |
| You iterated in Rocket and want to back up or share    | **Push** to GitHub                          |
| A teammate committed changes in their IDE              | **Pull** from GitHub into Rocket            |
| You edited code locally and want to continue in Rocket | **Pull** from GitHub into Rocket            |
| You want to trigger a CI/CD pipeline                   | **Push** to GitHub, then your pipeline runs |

<Divider />

## Disconnect

GitHub is connected at the workspace level. Disconnecting removes the GitHub link for your entire Rocket account.

<Card title="Disconnect a service" icon="plug" href="/getting-started/workspace/connectors#disconnect-a-service" horizontal arrow="true">
  Disconnect or switch accounts from workspace Settings.
</Card>

Your task files in Rocket remain intact after disconnecting. To reconnect, go through the same steps and authorize a GitHub account.

<Divider />

## Limitations

* **Next.js TypeScript only for pull and auto PR.** Two-way sync and automatic PR creation require a Next.js project using TypeScript. JavaScript-only Next.js projects and all other frameworks support manual push only, with no automatic PR.
* **Branch behaviour.** For Next.js TypeScript projects, Rocket pulls from `main` and pushes to a `rocket-update` branch, opening a PR to `main` for each batch of changes. For cloned repositories, Rocket pulls from the branch selected at clone time. Other branches are not synced.
* **Manual push for other frameworks.** For non-Next.js or JavaScript-only projects, you need to manually click Push when you want to update GitHub.

<Divider />

## One-way sync (other frameworks)

For non-Next.js or JavaScript-only projects, GitHub integration is push-only and manual. Push your code to GitHub for backup and collaboration by clicking the **Push** button when you want to update. No automatic pull request is created. Changes made directly in GitHub will not sync back to Rocket. Always make changes in Rocket first, then push.

<Card icon="github" href="/build/connectors/github/overview" horizontal arrow="true">
  See the full GitHub connector setup guide, including authorization and permissions.
</Card>

<Divider />

## What's next?

<CardGroup cols={2}>
  <Card title="From GitHub" icon="github" href="/build/create/from-github">
    Import an existing Next.js TypeScript repo to start building in Rocket.
  </Card>

  <Card title="Code tab" icon="code" href="/build/editor/code">
    Browse and edit your project files directly in Rocket.
  </Card>

  <Card title="Netlify" icon="globe" href="/build/connectors/netlify">
    Deploy your app to the web after pushing to GitHub.
  </Card>

  <Card title="GitHub connector" icon="github" href="/build/connectors/github/overview">
    Connect your GitHub account, manage repository settings, and push code.
  </Card>
</CardGroup>
