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

# vibe commit

> Create a commit with staged changes

## Usage

```bash theme={null}
vibe commit [options]
```

## Description

Create a new commit from your staged changes. This captures your code changes along with any AI prompts that were used during development.

## Options

<ParamField query="-m, --message" type="string" required>
  The commit message describing your changes.
</ParamField>

<ParamField query="--no-prompts" type="boolean">
  Skip capturing AI prompts for this commit.
</ParamField>

<ParamField query="--author" type="string">
  Override the commit author (format: "Name \<email>").
</ParamField>

## Examples

### Basic Commit

```bash theme={null}
vibe commit -m "Add user authentication"
```

### Commit with Multi-line Message

```bash theme={null}
vibe commit -m "Add user authentication

- Implement login form
- Add JWT token handling
- Create auth middleware"
```

### Commit Without AI Prompts

```bash theme={null}
vibe commit -m "Update dependencies" --no-prompts
```

## Workflow

<Steps>
  <Step title="Make Changes">
    Edit your code files
  </Step>

  <Step title="Stage Files">
    ```bash theme={null}
    vibe add .
    ```
  </Step>

  <Step title="Commit">
    ```bash theme={null}
    vibe commit -m "Your commit message"
    ```
  </Step>

  <Step title="Push">
    ```bash theme={null}
    vibe push
    ```
  </Step>
</Steps>

## Output

A successful commit shows:

```
Creating commit...
✓ Captured 3 AI prompts
✓ Commit created: abc1234

[main abc1234] Add user authentication
 3 files changed, 127 insertions(+), 12 deletions(-)

Run 'vibe push' to sync with VibeHub.
```

## What Gets Committed

| Content                                | Included         |
| -------------------------------------- | ---------------- |
| Staged file changes                    | Yes              |
| Commit message                         | Yes              |
| Author information                     | Yes              |
| Timestamp                              | Yes              |
| AI prompts (from Cursor, Claude, etc.) | Yes (by default) |

## AI Prompt Capture

One of VibeHub's unique features is capturing AI prompts alongside your commits. When you commit:

1. VibeHub scans for recent AI conversations
2. Prompts from supported editors are captured
3. Prompts are linked to the commit

### Supported AI Tools

* Cursor
* Claude
* GitHub Copilot Chat
* Other AI assistants

<Tip>
  AI prompts help your team understand not just *what* changed, but *why* and *how* the code was developed.
</Tip>

### Disabling Prompt Capture

If you don't want to include AI prompts for a specific commit:

```bash theme={null}
vibe commit -m "Routine update" --no-prompts
```

## Writing Good Commit Messages

<AccordionGroup>
  <Accordion title="Be Descriptive" icon="pen">
    Explain what the commit does and why.

    **Good:** `Add password reset functionality with email verification`

    **Bad:** `Fix stuff`
  </Accordion>

  <Accordion title="Use Imperative Mood" icon="bullhorn">
    Write as if giving a command.

    **Good:** `Add login validation`

    **Bad:** `Added login validation`
  </Accordion>

  <Accordion title="Keep First Line Short" icon="ruler">
    Aim for 50 characters or less for the first line. Add details in subsequent lines.

    ```bash theme={null}
    vibe commit -m "Add user authentication

    - Implement JWT token generation
    - Add login/logout endpoints
    - Create auth middleware"
    ```
  </Accordion>

  <Accordion title="Reference Issues" icon="ticket">
    If applicable, reference issue numbers.

    ```bash theme={null}
    vibe commit -m "Fix login timeout issue (#42)"
    ```
  </Accordion>
</AccordionGroup>

## Common Patterns

### Feature Commit

```bash theme={null}
vibe add src/features/auth/
vibe commit -m "Add user authentication feature

- Login and logout functionality
- Session management
- Password hashing with bcrypt"
```

### Bug Fix

```bash theme={null}
vibe add src/utils/validation.js
vibe commit -m "Fix email validation regex (#123)

The previous regex didn't handle plus signs in email addresses."
```

### Refactoring

```bash theme={null}
vibe add src/components/
vibe commit -m "Refactor Button component for better accessibility

- Add ARIA labels
- Improve keyboard navigation
- Extract shared styles"
```

## Error Handling

### Nothing to Commit

```
Error: Nothing to commit. Stage files with 'vibe add' first.
```

**Solution:** Stage files before committing:

```bash theme={null}
vibe add .
vibe commit -m "Your message"
```

### Empty Commit Message

```
Error: Commit message cannot be empty.
```

**Solution:** Provide a message with `-m`:

```bash theme={null}
vibe commit -m "Add feature"
```

### Not Initialized

```
Error: Not a VibeHub repository. Run 'vibe init' first.
```

**Solution:** Initialize VibeHub in your project:

```bash theme={null}
vibe init
```

## Local vs Remote

<Note>
  `vibe commit` creates a commit **locally**. To sync with VibeHub, you must run `vibe push`.
</Note>

```bash theme={null}
# Create local commit
vibe commit -m "Add feature"

# Push to VibeHub
vibe push
```

## Related Commands

* [vibe add](/cli/commands/add) - Stage files for commit
* [vibe push](/cli/commands/push) - Push commits to VibeHub
* [vibe status](/cli/commands/status) - Check what's staged
* [vibe log](/cli/commands/log) - View commit history
