← 返回命令列表

Linux command

git-difftool 命令

文件

复制后可按需替换文件名、目录或参数。

常用示例

Compare using external tool

git difftool [file]

Compare with specific tool

git difftool -t [vimdiff] [file]

Compare without prompts

git difftool -y [file]

Compare staged changes

git difftool --staged

Compare commits

git difftool [commit1] [commit2]

Directory diff mode

git difftool -d [commit]

说明

git difftool launches external visual diff tools to review changes in Git repositories. Unlike the built-in git diff which displays changes in the terminal, difftool provides a graphical or enhanced viewing experience through specialized applications. The command supports a wide variety of diff tools including vimdiff, meld, kdiff3, emerge, opendiff, and many others. Directory diff mode (-d) is particularly useful for graphical tools that support comparing entire directory trees simultaneously.

参数

-t, --tool _tool_
Use specific diff tool.
-y, --no-prompt
Don't prompt before launching.
-d, --dir-diff
Directory diff mode.
--staged
Compare staged changes.
--tool-help
List available tools.
-x _cmd_
Custom command.

FAQ

What is the git-difftool command used for?

git difftool launches external visual diff tools to review changes in Git repositories. Unlike the built-in git diff which displays changes in the terminal, difftool provides a graphical or enhanced viewing experience through specialized applications. The command supports a wide variety of diff tools including vimdiff, meld, kdiff3, emerge, opendiff, and many others. Directory diff mode (-d) is particularly useful for graphical tools that support comparing entire directory trees simultaneously.

How do I run a basic git-difftool example?

Run `git difftool [file]` in a terminal, then adjust file names, paths, flags, or remote targets for your system.

What does -t, --tool _tool_ do in git-difftool?

Use specific diff tool.