Skip to content

Document the Git repository that init creates - #337

Draft
tnkuehne wants to merge 1 commit into
mainfrom
cli-init-git-main-docs
Draft

tnkuehne wants to merge 1 commit into
mainfrom
cli-init-git-main-docs

Conversation

@tnkuehne

@tnkuehne tnkuehne commented Nov 23, 2026 •

Copy link
Copy Markdown
Contributor

Documentation for #336.

What changes

  • CLI reference, "Create a project" (apps/docs/docs/reference/cli.mdx): init creates a Git repository on branch main. Inside an existing repository the project uses that one, and without Git the first deploy that saves source creates it.
  • Source code guide, "Deploy the main app from another branch" (apps/docs/docs/guides/source-code.md): if a repository has no local main, for example after git init named the first branch master, rename it with git branch -m main.

Blocked by

Checks

  • oxfmt --check on both files and blume validate (no broken links).

@cloudflare-workers-and-pages

cloudflare-workers-and-pages Bot commented Nov 23, 2026 •

Copy link
Copy Markdown

Deploying with  Cloudflare Workers  Cloudflare Workers

The latest updates on your project. Learn more about integrating Git with Workers.

Status Name Latest Commit Updated (UTC)
✅ Deployment successful!
View logs
widefleet-docs 02ca58d Nov 23 2026, 02:45 PM

tnkuehne added a commit that referenced this pull request Nov 23, 2026
## Why

`widefleet init` did not create a Git repository. A plain `git init`
afterwards names the first branch `master` unless `init.defaultBranch`
is configured (Git 2.53 still does). `widefleet deploy` saves the main
app's source from the local branch `main`, so it then asks for
confirmation in a terminal and fails without one, for example in CI or
an agent shell:

```
You are on local branch master. This deploy updates branch main in Widefleet Git and publishes the code as the main app. Switch to main, or pass --allow-branch-mismatch to confirm this deployment
```

There is no `main` to switch to in that repository, so the hint does not
help either.

## What changes

- **`init`** (`crates/platform-cli/src/installation.rs`) runs `git init
--initial-branch=main` in the new project, without a commit. A later
`git init` only reinitializes it and keeps `main`.
- A project inside an existing Git work tree, such as a monorepo, uses
that repository, as deploy already does. No nested repository is
created.
- Without Git, `init` still creates the project, and deploy initializes
the repository as before.
- **Deploy branch error** (`crates/platform-cli/src/source.rs`): when
the checkout has no local branch `main`, the error suggests `git branch
-m main` instead of switching branches.

## Tests

- New unit test: `init` starts a repository on `main`, and does not nest
one inside an existing repository.
- `cli.test.ts`: the branch mismatch test checks the rename hint.
- `cargo clippy -p platform-cli --all-targets -D warnings`, `cargo test
-p platform-cli` (63 passed) and `RUN_CLI_TESTS=1 vitest run
apps/control-plane/tests/cli.test.ts` (61 passed).
- Ran the built CLI from an assembled installation: `init my-app` prints
`Initialized a Git repository on branch main`, a following `git init`
keeps `main`, and `init` inside an existing repository creates no
`.git`.

Documentation: #337 (draft until a CLI release includes this change).


<!-- greptile_comment -->

<!-- greptile_summary -->

<h2><a
href="https://app.greptile.com/api/retrigger?id=116576946&amp;sig=f62e811b66de83154f44bb78adc0ed16f4b4f7838876f3737e2d775085ac22c2"><picture><source
media="(prefers-color-scheme: dark)"
srcset="https://greptile-static-assets.s3.amazonaws.com/badges/RetriggerDark.svg?v=2"><source
media="(prefers-color-scheme: light)"
srcset="https://greptile-static-assets.s3.amazonaws.com/badges/Retrigger.svg?v=2"><img
alt="Retrigger"
src="https://greptile-static-assets.s3.amazonaws.com/badges/Retrigger.svg?v=2"
align="right"></picture></a><a
href="https://app.greptile.com/-/switch-tenant?tenant=mendra&amp;next=%2Fwidefleet%2Fwidefleet%2Fpull%2F336&amp;utm_source=greptile_review&amp;utm_medium=github&amp;utm_campaign=view_in_greptile"><picture><source
media="(prefers-color-scheme: dark)"
srcset="https://greptile-static-assets.s3.amazonaws.com/badges/ViewInGreptileDark.svg?v=2"><source
media="(prefers-color-scheme: light)"
srcset="https://greptile-static-assets.s3.amazonaws.com/badges/ViewInGreptile.svg?v=2"><img
alt="View in Greptile"
src="https://greptile-static-assets.s3.amazonaws.com/badges/ViewInGreptile.svg?v=2"
align="right"></picture></a>Confidence Score: 5/5</h2>

<!-- greptile-impact-verdict --> The PR appears safe to merge.

<details open><summary><h3>Summary</h3></summary>

New projects start on Git branch `main` without an initial commit.
- New projects start on the Git `main` branch.
- Deploy explains how to rename a branch when local `main` is missing.

No actionable issues were found.
</details>

<!-- greptile_confidence_score:5 -->

<sub>Reviews (1) · Last reviewed commit: ["Start new projects on a Git
main
branch"](7c3bf2f)
· [Reviewed by
Greptile](https://www.greptile.com/?utm_source=greptile_review&utm_medium=github&utm_campaign=review_public&utm_content=widefleet/widefleet)</sub>

<!-- /greptile_comment -->
Base automatically changed from cli-init-git-main to main November 23, 2026 14:14
@tnkuehne
tnkuehne force-pushed the cli-init-git-main-docs branch from 7766e2c to 02ca58d Compare November 23, 2026 14:43
widefleet init starts new projects on branch main. The source code guide
shows how to rename a master branch before deploying the main app.
@jonathanlaib jonathanlaib added the documentation Improvements or additions to documentation label Nov 23, 2026

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

documentation Improvements or additions to documentation

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants