git difftool

External Tools

Show changes in a visual diff tool


The 'git difftool' command shows the same changes as git diff, but opens each changed file in a visual diff program (VS Code, Meld, Beyond Compare…) side by side. It accepts the same arguments as git diff: --staged, commits, branches, paths.

Synopsis

git difftool [--tool=<tool>] [-y] [<git-diff-options>] [<commit> [<commit>]] [--] [<path>...]
[ ] optional| or<arg> placeholder... repeatable--flag option

Examples

Unstaged changes

git difftool

Each changed file in the tool.


Against a branch

git difftool main

Compare with main.


All files at once

git difftool --dir-diff

One folder comparison.

Workflow Examples

1
git config --global diff.tool vscode

Choose the tool

2
git difftool --dir-diff main...feature

All changes of the branch

Troubleshooting

It asks "Launch … [Y/n]?" for every file

Cause: Prompting is on

Add -y or set difftool.prompt false

Tips & Pitfalls

Best Practices

  • ✓Use --dir-diff to review many files at once.

FAQ

A:

No, it only displays differences.