目录 搜索
Guides gitattributes giteveryday gitglossary gitignore gitmodules gitrevisions gittutorial gitworkflows Administration git archive git bundle git clean git filter-branch git fsck git gc git instaweb git reflog Basic Snapshotting git add git commit git diff git mv git reset git rm git status Branching and Merging git branch git checkout git log git merge git mergetool git stash git tag Debugging git bisect git blame git grep Email git am git format-patch git request-pull git send-email External Systems git fast-import git svn Getting and Creating Projects git clone git init Git git annotate git archimport git bisect-lk2009 git check-attr git check-mailmap git check-ref-format git checkout-index git cherry git citool git column git credential git credential-cache git credential-store git cvsexportcommit git cvsimport git cvsserver git diff-files git diff-tree git difftool git fast-export git fetch-pack git fmt-merge-msg git get-tar-commit-id git gui git http-backend git http-fetch git http-push git imap-send git index-pack git interpret-trailers git ls-remote git ls-tree git mailinfo git mailsplit git merge-file git merge-index git merge-one-file git merge-tree git mktag git mktree git name-rev git notes git p4 git pack-objects git pack-redundant git pack-refs git parse-remote git patch-id git prune git prune-packed git quiltimport git receive-pack git remote-ext git remote-fd git remote-testgit git repack git replace git rerere git send-pack git sh-i18n git sh-setup git shell git show-branch git show-index git stripspace git unpack-file git unpack-objects git upload-archive git upload-pack git var git verify-commit git verify-tag git whatchanged git worktree Inspection and Comparison git describe git shortlog git show Miscellaneous api credentials api index gitcli gitcore tutorial gitcredentials gitcvs migration gitdiffcore githooks gitk gitnamespaces gitremote helpers gitrepository layout gitsubmodules gittutorial 2 gitweb gitweb.conf pack format User Manual Patching git apply git cherry-pick git rebase git revert Plumbing Commands git cat-file git check-ignore git commit-tree git count-objects git diff-index git for-each-ref git hash-object git ls-files git merge-base git read-tree git rev-list git rev-parse git show-ref git symbolic-ref git update-index git update-ref git verify-pack git write-tree Server Admin git daemon git update-server-info Setup and Config git git config git help Sharing and Updating Projects git fetch git pull git push git remote git submodule
文字

名称

git-difftool  - 使用常见差异工具显示更改

概要

git difftool [<options>] [<commit> [<commit>]] [--] [<path>…]

描述

git difftool是一个 Git 命令,允许您使用常见差异工具在修订之间比较和编辑文件。git difftool是前端git diff并接受相同的选项和参数。参见 git-diff [1]。

选项

-d   --dir-diff

将修改后的文件复制到临时位置,然后对它们执行一个目录 diff。该模式在启动 diff 工具之前从不提示。

-y   --no-prompt

启动 diff 工具前不要提示。

--prompt

在每次调用 diff 工具前提示。这是默认行为; 该选项用于覆盖任何配置设置。

-t <tool>   --tool=<tool>

使用<tool>指定的 diff 工具。有效值包括 emerge,kompare,meld 和 vimdiff。运行git difftool --tool-help有效的<工具>设置列表。

如果没有指定 diff 工具,git difftool将使用配置变量diff.tool。如果配置变量diff.tool没有设置,git difftool会选择一个合适的默认值。

您可以通过设置配置变量明确提供工具的完整路径difftool.<tool>.path。例如,您可以通过设置配置 kdiff3 的绝对路径difftool.kdiff3.path。否则,git difftool假定该工具在 PATH 中可用。

git difftool通过指定要在配置变量中调用的命令行,可以自定义运行其中一个已知的差异工具,以运行替代程序difftool.<tool>.cmd

git difftool用此工具调用(通过-t--tool选项或diff.tool配置变量)所配置的命令行将具有可用以下变量来调用:$LOCAL被设置为包含DIFF前图像的内容的临时文件的名字和$REMOTE是设置为包含diff post-image内容的临时文件的名称。$MERGED是正在比较的文件的名称。$BASE是为了与自定义合并工具命令兼容而提供的,并且具有与$MERGED相同的值。

--tool-help

打印可能使用的差异工具列表--tool

--no-symlinks

git difftool默认行为是在--dir-diff模式下运行时为工作树创建符号链接,比较的右侧产生与工作树中文件相同的内容。

指定--no-symlinks指示git difftool来创建副本。--no-symlinks是Windows上的默认值。

-x <command>   --extcmd=<command>

指定用于查看差异的自定义命令。git-difftool忽略配置的默认值并$command $LOCAL $REMOTE在指定此选项时运行。此外,$BASE在环境中设置。

-g   --no-gui

git-difftool使用-g--gui选项调用默认差异工具时,将从配置的diff.guitool变量中读取,而不是从中读取diff.tool。该--no-gui选项可用于覆盖此设置。

--no-trust-exit-code

git-difftool在每个文件上分别调用 diff 工具。默认情况下,diff 工具报告的错误将被忽略。使用--trust-exit-code做出git-difftool退出时调用的 diff 工具返回一个非零退出代码。

git-difftool将在--trust-exit-code使用时转发所调用的工具的退出代码。

有关支持选项的完整列表,请参阅 git-diff [1]。

配置变量

如果尚未定义difftool等价物,则git difftool回退到git mergetool配置变量。

diff.tool

要使用的默认差异工具。

diff.guitool

--gui指定时使用的默认差异工具。

difftool.<tool>.path

覆盖给定工具的路径。如果您的工具不在 PATH 中,这非常有用。

difftool.<tool>.cmd

指定用于调用指定的 diff 工具的命令。

有关--tool=<tool>更多详细信息,请参阅上述选项

difftool.prompt

在每次调用 diff 工具前提示。

difftool.trustExitCode

如果被调用的 diff 工具返回非零退出状态,则退出 difftool。

有关--trust-exit-code更多详细信息,请参阅上述选项

上一篇: 下一篇: