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

> Switch branches or create a new branch

## Usage

```bash theme={null}
vibe checkout <branch> [options]
```

## Description

Switch to a different branch or create a new branch and switch to it. This command changes your working context to the specified branch.

<Tip>
  `vibe switch` is available as an alias with the same functionality, using Git's newer syntax.
</Tip>

## Arguments

<ParamField query="branch" type="string" required>
  Branch name to switch to or create.
</ParamField>

## Options

<ParamField query="-b, --create" type="boolean">
  Create a new branch and switch to it.
</ParamField>

<ParamField query="--source" type="string">
  Source branch to create from (used with `-b`). Defaults to current branch.
</ParamField>

## Examples

### Switch to an Existing Branch

```bash theme={null}
vibe checkout develop
```

Output:

```
Switched to branch 'develop'
  at commit abc1234
```

### Create and Switch to a New Branch

```bash theme={null}
vibe checkout -b feature/user-auth
```

Output:

```
Switched to a new branch 'feature/user-auth'
  created from 'main'
```

### Create Branch from Specific Source

```bash theme={null}
vibe checkout -b hotfix/urgent --source production
```

Creates a new branch from `production` instead of the current branch.

## The `switch` Alias

`vibe switch` works the same as `vibe checkout`, using Git's newer command syntax:

```bash theme={null}
# Switch to existing branch
vibe switch develop

# Create and switch (use -c instead of -b)
vibe switch -c feature/new-feature

# Create from specific source
vibe switch -c hotfix --source production
```

## Behavior

When you checkout a branch:

1. Your working context switches to that branch
2. Future `vibe push` commands will push to that branch
3. Future `vibe pull` commands will pull from that branch
4. The branch indicator in `vibe branch` updates

## Error Messages

### Branch Not Found

```
Branch 'feature' not found
Use 'vibe checkout -b feature' to create it
```

**Solution:** Create the branch with `-b` flag or check the branch name.

### Already on Branch

```
Already on 'main'
```

This is informational - you're already on the requested branch.

### Branch Already Exists (when creating)

```
A branch named 'feature' already exists
Use 'vibe checkout feature' to switch to it
```

**Solution:** Switch to the existing branch or choose a different name.

## Workflow Examples

### Feature Branch Workflow

```bash theme={null}
# Start on main
vibe checkout main

# Create feature branch
vibe checkout -b feature/login

# Work on feature...
vibe add .
vibe commit -m "Add login form"
vibe push

# Switch back to main
vibe checkout main

# Merge feature
vibe merge feature/login
```

### Hotfix Workflow

```bash theme={null}
# Create hotfix from production
vibe checkout -b hotfix/security --source production

# Fix the issue
vibe add .
vibe commit -m "Fix security vulnerability"
vibe push

# Merge to production and main
vibe checkout production
vibe merge hotfix/security

vibe checkout main
vibe merge hotfix/security
```

## Related Commands

* [vibe branch](/cli/commands/branch) - List and manage branches
* [vibe merge](/cli/commands/merge) - Merge branches
* [vibe push](/cli/commands/push) - Push to current branch
