目录 搜索
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
文字

Name

git-mergetool  - 运行合并冲突解决工具来解决合并冲突

概要

git mergetool [--tool=<tool>] [-y | --[no-]prompt] [<file>…]

描述

使用git mergetool运行的几种合并一个实用程序来解决合并冲突。它通常在之后运行git merge

如果给出一个或多个<file>参数,则将运行合并工具程序以解决每个文件上的差异(跳过那些没有冲突的文件)。指定一个目录将包含该路径中所有未解析的文件。如果未指定<文件>名称,git mergetool则会在每个存在合并冲突的文件上运行合并工具程序。

选项

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

使用<tool>指定的合并解析程序。有效值包括emerge,gvimdiff,kdiff3,meld,vimdiff和tortoisemerge。运行git mergetool --tool-help有效的<工具>设置列表。

如果没有指定合并解析程序,git mergetool将使用配置变量merge.tool。如果配置变量merge.tool没有设置,git mergetool会选择一个合适的默认值。

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

git mergetool可以通过指定要在配置变量中调用的命令行来定制运行其他程序,而不是运行其中一个已知的合并工具程序mergetool.<tool>.cmd

git mergetool使用此工具调用此工具时(通过-t--tool选项或merge.tool配置变量),将调用已配置的命令行并将其$BASE设置为包含合并公共基础的临时文件的名称(如果可用); $LOCAL设置为包含当前分支上文件内容的临时文件的名称; $REMOTE设置为包含要合并的文件内容的临时文件的名称,并将其$MERGED设置为合并工具应写入合并解析结果的文件的名称。

如果自定义合并工具使用其退出代码正确指示合并分辨率的成功,则可将该配置变量mergetool.<tool>.trustExitCode设置为true。否则,git mergetool将在用户工具退出后提示用户指示解析成功。

--tool-help

打印可能使用的合并工具列表--tool

-y   --no-prompt

在每次调用合并解析程序之前不要提示。如果通过--tool选项或merge.tool配置变量显式指定合并解析程序,则这是默认值。

--prompt

在每次调用合并解决方案之前提示,以使用户有机会跳过该路径。

-O<orderfile>

按照<orderfile>中指定的顺序处理文件,每行有一个shell glob模式。这覆盖了diff.orderFile配置变量(请参阅git-config [1])。取消diff.orderFile,使用-O/dev/null

临时文件

git mergetool*.orig在解析合并时创建备份文件。一旦文件合并并且git mergetool会话完成,这些文件就可以安全移除。

mergetool.keepBackup配置变量设置为false导致git mergetool在文件成功合并时自动删除备份。

上一篇: 下一篇: