git & WinMerge (msysgit)

发布于 2024-09-29 04:48:09 字数 847 浏览 8 评论 0原文

我读过有关这个主题的大量问答,并严格遵循所有说明。但尝试使用 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 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

尛丟丟 2024-10-06 04:48:09

与我的之前的答案相比< /a> (或这个,或那个),您的步骤包括一个额外的winmerge.sh 脚本末尾的双引号话

    #!/bin/sh
    echo Launching WinMergeU.exe: $1 $2
    "C:/Program Files/WinMerge/WinMergeU.exe" 
      git /e /u /dl "Base" /dr "Mine" "$1" "$2""
                                               ^
                                               |
                                    (this shouldn't be here)

虽如此,这些答案是关于使用 < 的 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 script

    #!/bin/sh
    echo Launching WinMergeU.exe: $1 $2
    "C:/Program Files/WinMerge/WinMergeU.exe" 
      git /e /u /dl "Base" /dr "Mine" "$1" "$2""
                                               ^
                                               |
                                    (this shouldn't be here)

That 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?") or araxis (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.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文