# warning: Cannot merge binary files: image.png (HEAD vs. feature)

**Code:** `warning: Cannot merge binary files` · **Category:** Git · **Seen on:** Git

Git can't merge binary files line by line.

## Meaning

Choose one version: `git checkout --ours image.png` or `--theirs`, then `git add`. Use LFS or `.gitattributes` with `merge=binary` to avoid corrupt merges.

## Common causes

- Binary file changed on both branches
- No merge driver
- Generated assets in git

## Quick fix

1. `git checkout --theirs image.png`
2. `git checkout --ours image.png`
3. `git add` and continue

## Detailed fix by platform

### Git

1. 

```bash
git checkout --ours image.png
git add image.png
```


## How to diagnose

1. **File** — binary?
2. **Which version** — wanted?
3. **Attribute** — merge=binary?

---
Source: [WhatIsMyError](https://whatismyerror.com/errors/git/conflict-binary-file)
