git & WinMerge (msysgit)
我读过有关这个主题的大量问答,并严格遵循所有说明。但尝试使用 WinMerge 设置 Git 进行比较和合并时,我仍然感到头疼。
我使用 Git 终端执行了以下步骤:
git config --global diff.tool winmerge
git config --global difftool.winmerge.cmd "winmerge.sh \"$LOCAL\" \"$REMOTE\""
git config --global difftool.prompt false
我还在我的 PATH
变量中包含的目录中设置了一个脚本,内容为:
#!/bin/sh
echo Launching WinMergeU.exe: $1 $2
"C:/Program Files/WinMerge/WinMergeU.exe" git /e /u /dl "Base" /dr "Mine" "$1" "$2""
当我
git mergetool
在 Git 终端中执行时,我看到:
Merging:
first.txt
Normal merge conflict for 'first.txt':
{local}: modified
{remote}: modified
Launching WinMergeU.exe:
所以在我看来, $LOCAL
和 $REMOTE
变量没有将任何内容传递到 winmerge.sh
脚本中。我在这里做错了什么?我必须假设它在配置部分。
I've read about a bajillion Q&A's on this very topic, and followed all the instructions to the letter. But I'm still getting headaches trying to set up Git to diff and merge using WinMerge.
I've taken the following steps using the Git terminal:
git config --global diff.tool winmerge
git config --global difftool.winmerge.cmd "winmerge.sh \"$LOCAL\" \"$REMOTE\""
git config --global difftool.prompt false
I've also set up a script in a directory included in my PATH
variable that reads:
#!/bin/sh
echo Launching WinMergeU.exe: $1 $2
"C:/Program Files/WinMerge/WinMergeU.exe" git /e /u /dl "Base" /dr "Mine" "$1" "$2""
When I execute
git mergetool
In the Git terminal, I see:
Merging:
first.txt
Normal merge conflict for 'first.txt':
{local}: modified
{remote}: modified
Launching WinMergeU.exe:
So it seems to me that the $LOCAL
and $REMOTE
variables aren't passing anything into the winmerge.sh
script. What am I doing wrong here? I have to assume its in the configuration part.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
与我的之前的答案相比< /a> (或这个,或那个),您的步骤包括一个额外的
winmerge.sh
脚本末尾的双引号话虽如此,这些答案是关于使用 < 的 difftool strong>
winmerge
,不支持3路合并(只有本地和远程,没有基地)。对于真正的合并工具,我建议
kdiff3
(如“是git-merge 是否可以忽略行尾差异?") 或araxis
(如 “如何将 Araxis 设置为 MSYS git 的差异/合并工具?”),您可以在其中看到三个变量(本地,使用远程和基地)。Compared to my previous answer (or this one, or that one), your steps include an extra double-quote at the end of
winmerge.sh
scriptThat being said, those answers were about difftool using
winmerge
, which doesn't support 3-way merge (there is only local and remote, no base).For a true merge tool, I would recommend
kdiff3
(as in "Is it possible for git-merge to ignore line-ending differences?") oraraxis
(as described in "How to set Araxis as diff / merge tool for MSYS git?"), where you can see the three variables (local, remote and base) used.