Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
22 changes: 21 additions & 1 deletion docs/commands/init.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,18 @@ description: Initialize a new project locally
# `init`

<!-- AUTO-GENERATED-CONTENT:START (GENERATE_COMMANDS_DOCS) -->
Configure continuous deployment for a new or existing project. To create a new project without continuous deployment, use `netlify sites:create`
Initialize a Netlify project in the current directory

Links this directory to a new or existing Netlify project and saves the project ID locally.
`netlify init` can be used with or without Git/continuous deployment.

The init command can:
- Create a new Netlify project, or link to an existing one
- Add `.netlify/` to `.gitignore`
- Create or update `netlify.toml` with detected build settings (optional)
- Connect a Git repository for continuous deployment (optional)

If no Git remote is detected, you can still create a project and deploy manually with `netlify deploy`.

**Usage**

Expand All @@ -25,5 +36,14 @@ netlify init
- `debug` (*boolean*) - Print debugging information
- `auth` (*string*) - Netlify auth token - can be used to run this command without logging in

**Examples**

```bash
netlify init
netlify init --manual
netlify init --force
netlify init --git-remote-name upstream
```


<!-- AUTO-GENERATED-CONTENT:END -->
2 changes: 1 addition & 1 deletion docs/index.md
Original file line number Diff line number Diff line change
Expand Up @@ -115,7 +115,7 @@ Manage netlify functions

### [init](/commands/init)

Configure continuous deployment for a new or existing project. To create a new project without continuous deployment, use `netlify sites:create`
Initialize a Netlify project in the current directory

### [link](/commands/link)

Expand Down
19 changes: 18 additions & 1 deletion src/commands/init/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,10 +7,27 @@ export const createInitCommand = (program: BaseCommand) =>
program
.command('init')
.description(
'Configure continuous deployment for a new or existing project. To create a new project without continuous deployment, use `netlify sites:create`',
`Initialize a Netlify project in the current directory
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Let's go with "Configure a new or existing Netlify project in the current directory"

And let's keep some mention of sites:create, but just not in the first line (which serves as the 'title'). Maybe near the bottom, after having explained everything that init does, call sites:create out as an alternative that does much less.


Links this directory to a new or existing Netlify project and saves the project ID locally.
\`netlify init\` can be used with or without Git/continuous deployment.
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Clarify this. Be more explicit. Assume the user is initializing their very first Netlify project, so they aren't familiar with these concepts.


The init command can:
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
The init command can:
The init command will:

- Create a new Netlify project, or link to an existing one
- Add \`.netlify/\` to \`.gitignore\`
- Create or update \`netlify.toml\` with detected build settings (optional)
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
- Create or update \`netlify.toml\` with detected build settings (optional)
- Configure your project's build settings (optionally automatically)
- Create or update \`netlify.toml\` with these build settings (optional)

- Connect a Git repository for continuous deployment (optional)
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Could this link to the relevant page in the Netlify docs?


If no Git remote is detected, you can still create a project and deploy manually with \`netlify deploy\`.`,
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
If no Git remote is detected, you can still create a project and deploy manually with \`netlify deploy\`.`,

)
.option('-m, --manual', 'Manually configure a git remote for CI')
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

What exactly does this mean? When should it be used? Document this.

.option('--git-remote-name <name>', 'Name of Git remote to use. e.g. "origin"')
.addExamples([
'netlify init',
'netlify init --manual',
'netlify init --force',
'netlify init --git-remote-name upstream',
Comment on lines +27 to +29
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Include inline 'comments' explaining what these examples do

Suggested change
'netlify init --manual',
'netlify init --force',
'netlify init --git-remote-name upstream',
'netlify init --manual # foo what does this mean',
'netlify init --force',
'netlify init --git-remote-name upstream',

])
.addHelpText('after', () => {
const docsUrl = 'https://docs.netlify.com/cli/get-started/'
return `
Expand Down
Loading