difx is a command-line tool that uses Claude AI to explain git diffs. It's a drop-in replacement for the git diff command that provides AI-powered explanations of changes.
- Uses the same syntax as the standard
git diffcommand - Provides AI-powered explanations of code changes
- Gives Claude AI read-only access to your files to provide better context
- Securely stores your Claude API key in
~/.config/difx/config.json
- Go 1.21 or higher
- Git
- Claude API key
git clone https://github.com/jeofo/difx.git
cd difx
go build -o difxThen, move the binary to a location in your PATH:
sudo mv difx /usr/local/bin/# Basic usage (same as git diff)
difx
# Compare with specific commit
difx HEAD~1
# Compare specific files
difx file1.go file2.go
# Compare branches
difx main feature-branch
# Show only names of changed files
difx --name-onlyOn first run, difx will prompt you for your Claude API key, which will be stored in ~/.config/difx/config.json.
difxruns the standard git diff command with your arguments- It sends the diff output to Claude API for analysis
- Claude analyzes the changes and provides a human-readable explanation
- The explanation is displayed in your terminal
difx supports most of the standard git diff options, including:
--stat: Show a summary of changes--name-only: Show only the names of changed files--name-status: Show the names and status of changed files--patchor-p: Generate patch (default)--unified=<n>or-U<n>: Show n lines of context--diff-filter=<filter>: Filter by added/modified/deleted files
If you need to update your Claude API key, you can either:
- Edit the config file directly at
~/.config/difx/config.json - Delete the config file and run
difxagain to be prompted for a new key