> ## 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 push

> Push local commits to VibeHub

## Usage

```bash theme={null}
vibe push [remote] [branch] [options]
```

## Description

Push your local commits to your VibeHub project in the cloud. This syncs your local changes with the remote repository, including any captured AI prompts.

## Arguments

<ParamField query="remote" type="string">
  Remote name to push to. Defaults to `origin`.
</ParamField>

<ParamField query="branch" type="string">
  Branch to push. Defaults to the current branch.
</ParamField>

## Options

<ParamField query="-f, --force" type="boolean">
  Force push even if there are conflicts. Use with caution.
</ParamField>

<ParamField query="-d, --dry-run" type="boolean">
  Preview what would be pushed without actually pushing.
</ParamField>

<ParamField query="-p, --project-id" type="string">
  Specify a project ID to push to. Useful when working with multiple projects.
</ParamField>

<ParamField query="-b, --build" type="boolean">
  Build the project locally before pushing (runs `npm run build`).
</ParamField>

<ParamField query="-u, --set-upstream" type="boolean">
  Set upstream tracking for the branch.
</ParamField>

<ParamField query="--delete" type="string">
  Delete a remote branch.
</ParamField>

## Examples

### Basic Push

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

Pushes all new commits to the current branch on the connected VibeHub project.

### Push to a Specific Branch

```bash theme={null}
vibe push origin feature-branch
```

Pushes commits to the `feature-branch` on the remote.

### Push and Set Upstream

```bash theme={null}
vibe push -u origin feature-branch
```

Pushes to `feature-branch` and sets it as the upstream tracking branch.

### Preview Changes

```bash theme={null}
vibe push --dry-run
```

Shows what would be pushed without actually pushing. Useful for verification.

### Push with Build

```bash theme={null}
vibe push --build
```

Builds the project locally before pushing, including build output in the push.

### Force Push

<Warning>
  Force pushing will overwrite remote changes. Make sure you know what you're doing.
</Warning>

```bash theme={null}
vibe push --force
```

### Delete a Remote Branch

```bash theme={null}
vibe push --delete feature-branch
```

Deletes the `feature-branch` from the remote VibeHub project.

<Note>
  You cannot delete the default branch or protected branches.
</Note>

## Branch Workflow

VibeHub CLI uses Git for local branch management. Here's a typical workflow:

### Create and Push a New Branch

```bash theme={null}
# Create a new branch locally using Git
git checkout -b feature/new-feature

# Make your changes and commit
vibe add .
vibe commit -m "Add new feature"

# Push to the new branch with upstream tracking
vibe push -u origin feature/new-feature
```

### Switch Branches and Push

```bash theme={null}
# Switch to an existing branch
git checkout develop

# Push to that branch
vibe push
```

### Push to a Different Branch

```bash theme={null}
# Push current commits to a specific branch
vibe push origin staging
```

## What Gets Pushed

When you push, VibeHub receives:

| Content                  | Included |
| ------------------------ | -------- |
| Commit message           | Yes      |
| Changed files            | Yes      |
| File contents            | Yes      |
| Author information       | Yes      |
| Timestamp                | Yes      |
| Branch information       | Yes      |
| AI prompts (if captured) | Yes      |

## Prerequisites

Before pushing, ensure you have:

1. **Authenticated** with `vibe login`
2. **Initialized** your project with `vibe init`
3. **Connected** to a VibeHub project with `vibe set <project-url>`

## Output

A successful push shows:

```
✅ Email authentication successful
Authenticated as: user@example.com
🔐 Checking permissions...
✅ Write permission confirmed
✅ Successfully pushed to VibeHub cloud!
```

## Error Handling

### Not Connected

```
Error: No project connected. Run 'vibe set <project-url>' first.
```

**Solution:** Connect to a project with `vibe set`.

### Not Authenticated

```
Error: Not logged in. Run 'vibe login' first.
```

**Solution:** Authenticate with `vibe login`.

### Permission Denied

```
❌ Push permission denied
You have read-only access to this project.
```

**Solution:** Contact the project owner to request write access.

### Cannot Delete Default Branch

```
Cannot delete the default branch 'main'
```

**Solution:** You cannot delete the default branch. Choose a different branch to delete.

### Conflicts

```
Error: Remote has changes. Pull first or use --force.
```

**Solution:** Either pull remote changes with `vibe pull` or force push with `--force`.

## Best Practices

<AccordionGroup>
  <Accordion title="Push Frequently" icon="repeat">
    Push often to keep your remote in sync and avoid large uploads.
  </Accordion>

  <Accordion title="Use Dry Run First" icon="eye">
    When unsure, use `--dry-run` to preview what will be pushed.
  </Accordion>

  <Accordion title="Set Upstream for New Branches" icon="link">
    Use `-u` flag when pushing a new branch for the first time.
  </Accordion>

  <Accordion title="Avoid Force Push" icon="triangle-exclamation">
    Force pushing can overwrite others' work. Use only when necessary.
  </Accordion>

  <Accordion title="Check Status First" icon="circle-check">
    Run `vibe status` before pushing to see what will be synced.
  </Accordion>
</AccordionGroup>

## Related Commands

* [vibe pull](/cli/commands/pull) - Pull changes from VibeHub
* [vibe status](/cli/commands/status) - Check sync status
* [vibe commit](/cli/commands/commit) - Create a commit
