> For the complete documentation index, see [llms.txt](https://docs.hex-rays.com/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.hex-rays.com/ida-9.5/add-ons/teams/how-tos/git-diff.md).

# Diffing IDA databases with git diff

IDA databases (`.i64`, `.idb`) are binary files, so by default Git can only tell you `Binary files a/db.i64 and b/db.i64 differ`. With the IDA diff driver installed, `git diff` instead prints a readable, structural diff of the two databases, produced by IDA itself:

* changed disassembly lines, names, comments, stack variables
* changes to functions, local types, cross-references, segments, and more

The output is plain text in the familiar unified diff format, so it works in a terminal, in scripts, in CI jobs, and as input for AI agents that need to review what changed in an analysis.

{% hint style="info" %}
A repository created or cloned through IDA includes an `AGENTS.md`/`CLAUDE.md` file that tells coding agents which exact commands to use for diffing, so they don't have to guess.
{% endhint %}

## How it works

Git lets a repository assign a custom *diff driver* to a file pattern through `.gitattributes`. IDA ships a small helper, `git-ida`, which registers itself as the diff driver for `*.i64` and `*.idb`. When Git needs to diff a database, it calls `git-ida`, which runs IDA headless (`idat`) on both versions of the database and passes the report back to Git.

The same helper also installs a filter that stores databases compactly (as deltas) and a merge driver for databases. Both run transparently.

## Prerequisites

* Git installed
* IDA Pro installed and an active IDA license with Teams add-on
* The `git-ida` version that ships with IDA 9.5 or later

| Platform | Location of `git-ida`                          |
| -------- | ---------------------------------------------- |
| Windows  | `<IDA dir>\tools\teams\git-ida.exe`            |
| Linux    | `<IDA dir>/tools/teams/git-ida`                |
| macOS    | `<IDA.app>/Contents/MacOS/tools/teams/git-ida` |

## Setup from the command line

You do not need to open the repository in IDA. The steps below use `$IDA_DIR` for the IDA installation directory (on macOS, the `Contents/MacOS` folder inside the `.app` bundle).

First, run `git ida install` once per machine. See [Making `git-ida` available to your shell](/ida-9.5/add-ons/teams/how-tos/git_ida_cli.md#making-git-ida-available-to-your-shell) for details. After that, a plain `git clone` of any `git-ida` repository checks out real databases right away, no further setup needed.

### Enable it in a new repository

```bash
cd my-repo
git config --local ida.path "$IDA_DIR/ida"   # or ida.exe on Windows
git ida initialize                           # add --lfs to store databases in Git LFS
git add .gitattributes .gitignore
git commit -m "Enable IDA database support"
```

Running `git ida initialize` registers the filter, merge and diff drivers in the repository's local Git config. It also adds these lines to `.gitattributes`:

```
*.i64 filter=git-ida merge=git-ida diff=git-ida -text
*.idb filter=git-ida merge=git-ida diff=git-ida -text
```

Point `ida.path` at the regular `ida` executable. The diff driver picks the console version (`idat`) next to it automatically.

### Clone a repository that already uses it

```bash
git clone <url> my-repo
```

Run `git ida status` at any time to check the configuration.

## Examples

Compare the database on disk (saved but not yet committed) with the last commit:

```bash
git diff HEAD -- malware.i64
```

Compare a database with its state from the previous commit:

```bash
git diff HEAD~1 -- malware.i64
```

Compare two branches:

```bash
git diff main feature/rename-crypto -- malware.i64
```

Show what a commit changed:

```bash
git show --ext-diff HEAD
git log -p --ext-diff -- malware.i64
```

{% hint style="info" %}
`git show` and `git log -p` only use custom diff drivers when you pass `--ext-diff`.
{% endhint %}

List only the changed locations, one per line (useful in scripts or as a compact summary for an agent):

```bash
git diff HEAD~1 -- malware.i64 | grep '^@@'
```

Skip the structural diff for one command:

```bash
git diff --no-ext-diff HEAD~1 -- malware.i64
```

### Sample output

This commit renamed a stack variable to `output_buffer`:

```diff
$ git show --ext-diff 8371f83
commit 8371f83

    renamed first parameter to output buffer

diff --ida a/git-ida.i64 b/git-ida.i64
index 5fdf1a2..b5b18fc 100644
@@ Disassembly/Items @@ _lzma_lzma_optimum_fast
 __text:000000010028C978 ; Attributes: bp-based frame
 __text:000000010028C978
 __text:000000010028C978                 EXPORT _lzma_lzma_optimum_fast
 __text:000000010028C978 _lzma_lzma_optimum_fast
 __text:000000010028C978
-__text:000000010028C978 var_AC          = -0xAC
+__text:000000010028C978 output_buffer   = -0xAC
 __text:000000010028C978 var_A8          = -0xA8
 __text:000000010028C978 var_A4          = -0xA4
@@ Disassembly/Items @@ _lzma_lzma_optimum_fast+688
-__text:000000010028D000                 STR             W8, [SP,#0xB0+var_AC]
+__text:000000010028D000                 STR             W8, [SP,#0xB0+output_buffer]
@@ Disassembly/Items @@ _lzma_lzma_optimum_fast+6A0
 __text:000000010028D018 loc_10028D018
-__text:000000010028D018                 LDR             W8, [SP,#0xB0+var_AC]
+__text:000000010028D018                 LDR             W8, [SP,#0xB0+output_buffer]
```

Each hunk header names the area of the database that changed (here `Disassembly/Items`) and the location, as a name plus offset.

## Notes and limitations

* Each diff runs IDA on both versions of the database, so on large databases it can take a while.
* `git diff --stat`, `--numstat` and `--shortstat` never call diff drivers, so for databases they only report that the binary file changed.
* If anything goes wrong (IDA not found, timeout, and so on), the driver falls back to the standard `Binary files ... differ` line and prints the reason on stderr. The rest of the `git diff` output is not affected.

## Configuration

All settings live in the repository's local Git config (`git config --local <key> <value>`):

| Key                    | Default | Meaning                                                                             |
| ---------------------- | ------- | ----------------------------------------------------------------------------------- |
| `ida.path`             |         | Path to the IDA executable                                                          |
| `ida.diff.enabled`     | `true`  | Set to `false` to always show `Binary files ... differ`                             |
| `ida.diff.timeout`     | `120`   | Seconds allowed for one database diff (`0` = no limit)                              |
| `ida.diff.maxFileSize` | `0`     | Skip the structural diff for databases larger than this many bytes (`0` = no limit) |

{% hint style="info" %}
To compare databases visually in the IDA GUI instead of in the terminal, use `git difftool -- malware.i64`.
{% endhint %}


---

# Agent Instructions
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.

## Querying This Documentation
If you need additional information that is not directly available in this page, you can query the documentation by asking a question.

Perform an HTTP GET request on the following URL with the `ask` and `goal` query parameters:

```
GET https://docs.hex-rays.com/ida-9.5/add-ons/teams/how-tos/git-diff.md?ask=<question>&goal=<user_goal>
```

`ask` is the immediate question: it should be specific, self-contained, and written in natural language.
`goal` is what the user is ultimately trying to achieve, the reason they need the answer. Sharing it helps GitBook give you a better, more relevant answer. A goal is most helpful when it describes the outcome the user wants rather than restating the question. For example, with `ask=how do I create an API token`, a goal like `automate deployments from our CI pipeline` lets GitBook tailor the answer to that use case.

The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
