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

# Quickstart

> Create your first stacked PR in minutes.

In **just a few steps**, you'll create **two stacked pull requests** using `mg` and see them on [cubic.dev](https://cubic.dev) (or GitHub).

***

## Quick installation (macOS)

```bash theme={null}
brew install cubic-io/homebrew-tap/mg
```

<Note>
  If you're not on macOS or need detailed instructions, see the [full installation
  guide](/installation).
</Note>

***

## 1) Initialize & set up

```bash theme={null}
cd /path/to/your-repo
mg init
```

This tells mg which branch is your trunk (`main` or `master`).

<Tip>
  **Authentication**: If you're not already logged in, mg may prompt you for a GitHub personal
  access token or use the GitHub CLI (`gh`) for OAuth.
</Tip>

***

## 2) Build your first stack

<Steps>
  <Step title="Check out trunk">
    ```bash theme={null}
    mg checkout main
    ```

    Make sure you're on the trunk branch.
  </Step>

  <Step title="Create the first branch">
    ```bash theme={null}
    mg branch feature_1
    mg list
    ```

    You should see:

    ```
    main
     └─ feature_1
    ```
  </Step>

  <Step title="Write code & commit">
    ```bash theme={null}
    mg add . && mg commit -m "My commit message"
    ```

    (Or use normal Git commands—unrecognized subcommands pass through to Git.)
  </Step>

  <Step title="Add a second branch">
    ```bash theme={null}
    mg branch feature_2
    mg add . && mg commit -m "Another commit"
    mg list
    ```

    Now:

    ```
    main
     └─ feature_1
        └─ feature_2
    ```
  </Step>

  <Step title="Push your stack to remote">
    ```bash theme={null}
    mg push
    ```

    By default, mg opens a text editor to let you tweak each PR's title/description.

    <Tip>
      `mg push --all` pushes **every** branch at once.

      If you push a child branch before its parent, mg may fail (the parent PR doesn't exist on remote yet).
    </Tip>
  </Step>

  <Step title="Check your PRs">
    Now each branch has an associated PR on [cubic.dev](https://cubic.dev) or GitHub.
    Open the UI to see them **stacked**. You've created a basic stacked workflow for your features!
  </Step>
</Steps>

***

## What's next?

* [Create a single Pull Request](/how-to-guides/create-a-pull-request) for a simpler, one-branch flow.

* [Keep Your Stack Updated](/how-to-guides/keep-your-stack-updated) if you need to handle merges or rebase conflicts.

* [Merge Your Stack](/how-to-guides/merge-your-stack) in the cubic UI once your PRs are approved.
