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

> Show changes between branches

## Usage

```bash theme={null}
vibe diff [branch1]..[branch2]
```

## Description

Compare two branches and show how they differ. Displays commits ahead/behind and the common ancestor.

## Arguments

<ParamField query="branch1..branch2" type="string">
  Branches to compare using `..` syntax.

  * `main..feature` - Compare main with feature
  * `..feature` - Compare current branch with feature
  * `main..` - Compare main with current branch
  * (no args) - Compare current branch with default branch
</ParamField>

## Examples

### Compare Two Branches

```bash theme={null}
vibe diff main..feature/api
```

Output:

```
Comparing main..feature/api

  main:
    Head commit: abc1234
  feature/api:
    Head commit: def5678

  feature/api is 3 commit(s) ahead of main
  feature/api is 1 commit(s) behind main

  Common ancestor: commit xyz9999
```

### Compare Current Branch with Default

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

Compares your current branch with the default branch (usually `main`).

### Compare with Current Branch

```bash theme={null}
vibe diff feature/ui..
```

Compares `feature/ui` with your current branch.

### Check if Branches are Identical

```bash theme={null}
vibe diff develop..staging
```

Output:

```
Comparing develop..staging

  develop:
    Head commit: abc1234
  staging:
    Head commit: abc1234

Branches are identical
```

## Understanding the Output

### Ahead/Behind

* **Ahead**: Commits in branch1 that are not in branch2
* **Behind**: Commits in branch2 that are not in branch1

### Common Ancestor

The most recent commit that both branches share. This is where the branches diverged.

## Workflow Examples

### Before Merging

```bash theme={null}
# Check what you're about to merge
vibe diff main..feature/payments

# If looks good, proceed
vibe checkout main
vibe merge feature/payments
```

### Check for Updates

```bash theme={null}
# Fetch latest
vibe fetch

# See if remote has new commits
vibe diff main..origin/main
```

### Review Feature Branch

```bash theme={null}
# How far ahead is the feature?
vibe diff main..feature/redesign
```

## Error Messages

### Same Branch

```
No difference - comparing same branch
```

**Solution:** Compare two different branches.

### Branch Not Found

```
Branch 'feature' not found
```

**Solution:** Check branch name with `vibe branch` or fetch with `vibe fetch`.

## Related Commands

* [vibe branch](/cli/commands/branch) - List branches
* [vibe merge](/cli/commands/merge) - Merge branches
* [vibe log](/cli/commands/log) - Show commit history
* [vibe fetch](/cli/commands/fetch) - Fetch remote branches
