# Merge line

An agent's branch merging into main, drawn the way git draws it.

Also called: git merge animation.

> chatcn Pro: needs a Pro license (https://chatcn.dev/pro). Install from the `@chatcn-pro` registry with your license token; setup at https://chatcn.dev/docs/chatcn-pro.

Example: An agent's branch coming home. The agent's commits run up their own lane in colour. Merge, and a row opens at the top, the branch line bends back into main and the merge commit lands with a ring. Preview: https://chatcn.dev/preview/merge-line-demo

The agent's commits run up their own lane in colour beside main. Merge, and history slides down a row to open the top, the branch's line bends back across into main as you watch, and the merge commit lands with a ring that takes the branch's colour for a moment. You can still see what the agent did and where it joined.

## Installation

```bash
npx shadcn@latest add @chatcn-pro/merge-line
```

## Usage

```tsx
import { MergeLine } from "@/components/ui/chatcn/pro/merge-line"

<MergeLine branch="agent/fix-refresh" branchCommits={ahead} mainCommits={behind} merged={merged} onMerge={merge} />
```

## Props

| Prop | Type | Notes |
| --- | --- | --- |
| `branch` | `string` |  |
| `branchCommits` | `{ id, message, hash? }[]` | Newest first |
| `mainCommits` | `{ id, message, hash? }[]` | Newest first, ending with the commit it was cut from |
| `merged` / `onMerge` | `boolean` / `() => void` |  |

## Accessibility

- History is an ordered list; the summary line says how many commits merged.

## Motion

- History slides 320 ms, the merge curve draws 460 ms, the commit pops with a 620 ms ring. Reduced motion: it appears merged.

Source: https://chatcn.dev/docs/components/merge-line