# What Are the Main Branches in the Corsair Repository?

> Discover the main branches in the Corsair repository: main for stable code and next for staging new features. Understand the development workflow.

- Repository: [corsairdev/corsair](https://github.com/corsairdev/corsair)
- Tags: internals
- Published: 2026-09-01

---

**The Corsair repository uses two principal branches: `main` for stable, production-ready code and `next` for staging upcoming features before release.**

Corsair follows a streamlined Git branching model that keeps development organized and release-ready. The `corsairdev/corsair` project delegates all permanent work to just two long-living branches, with feature branches created and destroyed as needed. Understanding this branch structure is essential for contributors who want to submit pull requests or cut releases.

## The Main Branch: Stable Production Baseline

The **`main`** branch serves as the single source of truth for the Corsair codebase.

This branch is marked as the **default branch** in the repository's Git configuration (`.git/config`). All official releases are tagged from `main`, making it the stable, production-ready baseline that end users depend on.

When you clone the repository, you automatically land on `main`:

```bash
git clone https://github.com/corsairdev/corsair.git
cd corsair
git status  # shows "On branch main"

```

The `main` branch appears in critical automation scripts. The CI workflow at [`.github/workflows/pr-checks.yml`](https://github.com/corsairdev/corsair/blob/main/.github/workflows/pr-checks.yml) checks out this branch during validation, and the [`README.md`](https://github.com/corsairdev/corsair/blob/main/README.md) references it as the primary branch for contributors.

## The Next Branch: Staging Ground for Upcoming Features

The **`next`** branch functions as the development line for features not yet ready for production.

According to the Corsair source code, `next` is explicitly referenced in internal tooling. The PR-review automation in [`scripts/pr-review/loop.ts`](https://github.com/corsairdev/corsair/blob/main/scripts/pr-review/loop.ts) handles "base branch" logic that treats `next` as the target for incoming changes. This confirms the branch's role as the integration point for new work.

The typical contributor workflow uses `next` as the branching point:

```bash

# Create a feature branch from the development line

git checkout -b feat/new-authentication next

# Complete work, then merge back into next

git checkout next
git merge feat/new-authentication

```

When changes in `next` mature and pass validation, maintainers promote them to `main`:

```bash

# Prepare a release by merging next into main

git checkout main
git merge next

```

## Where Branch References Live in the Codebase

These files define and enforce the branch strategy throughout the Corsair repository:

- **`.git/config`** — Stores the default branch setting (`main`)
- **[`.github/workflows/pr-checks.yml`](https://github.com/corsairdev/corsair/blob/main/.github/workflows/pr-checks.yml)** — CI workflow selecting the base branch for checks
- **[`scripts/pr-review/loop.ts`](https://github.com/corsairdev/corsair/blob/main/scripts/pr-review/loop.ts)** — Automation logic handling `next` branch operations
- **[`README.md`](https://github.com/corsairdev/corsair/blob/main/README.md)** — Documentation listing the primary branches for contributors

## Branch Comparison

| Branch | Lifecycle | Purpose | Merge Target |
|--------|-----------|---------|--------------|
| `main` | Permanent | Production releases, stable code | None (final destination) |
| `next` | Permanent | Feature integration, pre-release staging | `main` |

## Summary

- The Corsair repository centers on **two principal branches**: `main` and `next`
- **`main`** holds production-ready code and release tags
- **`next`** stages features before they merge to `main`
- Branch references appear in `.git/config`, CI workflows, and automation scripts
- Contributors branch from `next`, merge to `next`, and maintainers promote `next` to `main`

## Frequently Asked Questions

### Does Corsair use a GitFlow or trunk-based development model?

Corsair uses a simplified two-branch model closer to **GitHub Flow** than full GitFlow. The `next` branch replaces the complexity of `develop`, `release`, and `hotfix` branches. This reduces overhead while still separating stable and unstable code.

### How do I know which branch to target for my pull request?

Target **`next`** for new features and bug fixes. The PR-review automation in [`scripts/pr-review/loop.ts`](https://github.com/corsairdev/corsair/blob/main/scripts/pr-review/loop.ts) validates against the base branch, and the CI workflow at [`.github/workflows/pr-checks.yml`](https://github.com/corsairdev/corsair/blob/main/.github/workflows/pr-checks.yml) runs checks accordingly. Only critical hotfixes apply directly to `main`.

### What happens to feature branches after merging?

Feature branches are **deleted after merge**. Create them from `next` using descriptive names like `feat/description` or `fix/description`, merge via pull request, then delete both locally and remotely. The Corsair repository does not retain short-lived branches.

### Can I view the branches directly on GitHub?

Yes. Navigate to `https://github.com/corsairdev/corsair/tree/main` for the stable branch or `https://github.com/corsairdev/corsair/tree/next` for the development branch. The branch selector dropdown on the repository homepage toggles between them.