Git Diff 与 Beyond Compare

发布于 2024-08-18 03:23:36 字数 1077 浏览 5 评论 0原文

我已经成功地让 git 启动 Beyond Compare 3 作为 diff 工具,但是,当我进行 diff 时,我正在比较的文件没有被加载。仅加载该文件的最新版本,没有加载其他任何内容,因此 Beyond Compare 的右侧窗格中没有任何内容。

我正在使用 Cygwin 和 Beyond Compare 3 运行 git 1.6.3.1。我已经按照他们在其网站的支持部分中建议的那样设置了 Beyond Compare,其中的脚本如下:

#!/bin/sh  
# diff is called by git with 7 parameters:  
# path old-file old-hex old-mode new-file new-hex new-mode  
"path_to_bc3_executable" "$2" "$5" | cat

还有其他人遇到过这个问题并知道解决方案吗?

编辑:
我已遵循 VonC 的建议,但我仍然遇到与以前完全相同的问题。我对 Git 有点陌生,所以也许我没有正确使用 diff。

例如,我尝试使用如下命令查看文件上的差异:
git diff main.css

Beyond Compare 然后将打开并仅在左窗格中显示我当前的 main.css,右窗格中没有任何内容。我希望在左窗格中看到我当前的 main.css 与 HEAD 的比较,基本上是我上次提交的内容。

我的 git-diff-wrapper.sh 看起来像这样:

#!/bin/sh  
# diff is called by git with 7 parameters:  
# path old-file old-hex old-mode new-file new-hex new-mode  
"c:/Program Files/Beyond Compare 3/BCompare.exe" "$2" "$5" | cat

我的 git 配置对于 Diff 看起来像这样:

[diff]  
external = c:/cygwin/bin/git-diff-wrapper.sh

I have succeeded in getting git to start Beyond Compare 3 as a diff tool however, when I do a diff, the file I am comparing against is not being loaded. Only the latest version of the file is loaded and nothing else, so there is nothing in the right pane of Beyond Compare.

I am running git 1.6.3.1 with Cygwin with Beyond Compare 3. I have set up beyond compare as they suggest in the support part of their website with a script like such:

#!/bin/sh  
# diff is called by git with 7 parameters:  
# path old-file old-hex old-mode new-file new-hex new-mode  
"path_to_bc3_executable" "$2" "$5" | cat

Has anyone else encountered this problem and know a solution to this?

Edit:
I have followed the suggestions by VonC but I am still having exactly the same problem as before. I am kinda new to Git so perhaps I am not using the diff correctly.

For example, I am trying to see the diff on a file with a command like such:
git diff main.css

Beyond Compare will then open and only display my current main.css in the left pane, there is nothing in the right pane. I would like the see my current main.css in the left pane compared to the HEAD, basically what I have last committed.

My git-diff-wrapper.sh looks like this:

#!/bin/sh  
# diff is called by git with 7 parameters:  
# path old-file old-hex old-mode new-file new-hex new-mode  
"c:/Program Files/Beyond Compare 3/BCompare.exe" "$2" "$5" | cat

My git config looks like this for Diff:

[diff]  
external = c:/cygwin/bin/git-diff-wrapper.sh

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

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

发布评论

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

评论(21

迷雾森÷林ヴ 2024-08-25 03:23:36

我不使用额外的包装器 .sh 文件。我的环境是 Windows XP、cygwin 上的 git 1.7.1 和 Beyond Compare 3。以下是我的 .git/config 文件。

[diff]
    tool = bc3
[difftool]
    prompt = false
[difftool "bc3"]
    #use cygpath to transform cygwin path $LOCAL (something like /tmp/U5VvP1_abc) to windows path, because bc3 is a windows software
    cmd = \"c:/program files/beyond compare 3/bcomp.exe\" "$(cygpath -w $LOCAL)" "$REMOTE"
[merge]
    tool = bc3
[mergetool]
    prompt = false
[mergetool "bc3"]
    #trustExitCode = true
    cmd = \"c:/program files/beyond compare 3/bcomp.exe\" "$LOCAL" "$REMOTE" "$BASE" "$MERGED"

然后,我使用 $ git difftool 进行比较,使用 $ git mergetool 进行合并。

关于trustExitCode
对于自定义合并命令,指定是否可以使用合并命令的退出代码来确定合并是否成功。如果未设置为 true,则检查合并目标文件时间戳,如果文件已更新,则假定合并已成功,否则将提示用户指示合并成功。

另请参阅目录差异与工作目录(本地文件)。

I don't use extra wrapper .sh files. My environment is Windows XP, git 1.7.1 on cygwin, and Beyond Compare 3. Following is my .git/config file.

[diff]
    tool = bc3
[difftool]
    prompt = false
[difftool "bc3"]
    #use cygpath to transform cygwin path $LOCAL (something like /tmp/U5VvP1_abc) to windows path, because bc3 is a windows software
    cmd = \"c:/program files/beyond compare 3/bcomp.exe\" "$(cygpath -w $LOCAL)" "$REMOTE"
[merge]
    tool = bc3
[mergetool]
    prompt = false
[mergetool "bc3"]
    #trustExitCode = true
    cmd = \"c:/program files/beyond compare 3/bcomp.exe\" "$LOCAL" "$REMOTE" "$BASE" "$MERGED"

Then, I use $ git difftool to compare and $ git mergetool to merge.

About trustExitCode:
For a custom merge command, specify whether the exit code of the merge command can be used to determine whether the merge was successful. If this is not set to true then the merge target file timestamp is checked and the merge assumed to have been successful if the file has been updated, otherwise the user is prompted to indicate the success of the merge.

See also Directory Diff with working directory (local files).

请恋爱 2024-08-25 03:23:36

感谢 @dahlbykPosh-Git,发布他的配置作为要点 。它帮助我解决了我的配置问题。

[diff]
    tool = bc3
[difftool]
    prompt = false
[difftool "bc3"]
    cmd = \"c:/program files (x86)/beyond compare 3/bcomp.exe\" \"$LOCAL\" \"$REMOTE\"
[merge]
    tool = bc3
[mergetool]
    prompt = false
    keepBackup = false
[mergetool "bc3"]
    cmd = \"c:/program files (x86)/beyond compare 3/bcomp.exe\" \"$LOCAL\" \"$REMOTE\" \"$BASE\" \"$MERGED\"
    trustExitCode = true
[alias]
    dt = difftool
    mt = mergetool

Thanks to @dahlbyk, the author of Posh-Git, for posting his config as a gist. It helped me resolve my configuration issue.

[diff]
    tool = bc3
[difftool]
    prompt = false
[difftool "bc3"]
    cmd = \"c:/program files (x86)/beyond compare 3/bcomp.exe\" \"$LOCAL\" \"$REMOTE\"
[merge]
    tool = bc3
[mergetool]
    prompt = false
    keepBackup = false
[mergetool "bc3"]
    cmd = \"c:/program files (x86)/beyond compare 3/bcomp.exe\" \"$LOCAL\" \"$REMOTE\" \"$BASE\" \"$MERGED\"
    trustExitCode = true
[alias]
    dt = difftool
    mt = mergetool
黯然#的苍凉 2024-08-25 03:23:36

为 Beyond Compare 2 运行这些命令:

git config --global diff.tool bc2
git config --global difftool.bc2.cmd "\"c:/program files (x86)/beyond compare 2/bc2.exe\" \"\$LOCAL\" \"\$REMOTE\""
git config --global difftool.prompt false

为 Beyond Compare 3 运行这些命令:

git config --global diff.tool bc3
git config --global difftool.bc3.cmd "\"c:/program files (x86)/beyond compare 3/bcomp.exe\" \"\$LOCAL\" \"\$REMOTE\""
git config --global difftool.prompt false

然后使用 git difftool

Run these commands for Beyond Compare 2:

git config --global diff.tool bc2
git config --global difftool.bc2.cmd "\"c:/program files (x86)/beyond compare 2/bc2.exe\" \"\$LOCAL\" \"\$REMOTE\""
git config --global difftool.prompt false

Run these commands for Beyond Compare 3:

git config --global diff.tool bc3
git config --global difftool.bc3.cmd "\"c:/program files (x86)/beyond compare 3/bcomp.exe\" \"\$LOCAL\" \"\$REMOTE\""
git config --global difftool.prompt false

Then use git difftool

你是我的挚爱i 2024-08-25 03:23:36

官方文档对我有用:

BC 版本 3 或更高版本(Git for *nix)

Git 1.8 及更高版本

差异

确认可以从终端启动“bcompare”。然后在一个
控制台窗口输入:

$ git config --global diff.tool bc

$ git config --global difftool.bc.trustExitCode true

要使用 Beyond Compare 启动差异,请使用以下命令:

git difftool 文件.ext

合并(仅限专业版)

确认可以从终端启动“bcompare”。然后输入
以下内容:

git config --global merge.tool bc

git config --global mergetool.bc.trustExitCode true

要使用 Beyond Compare 启动 3 路合并,请使用以下命令:

git mergetool file.ext

Official documentation worked for me:

BC version 3 or later (Git for *nix)

Git 1.8 and newer

Diff

Confirm that "bcompare" can be launched from Terminal. Then in a
console window enter:

$ git config --global diff.tool bc

$ git config --global difftool.bc.trustExitCode true

To launch a diff using Beyond Compare, use the command:

git difftool file.ext

Merge (Pro only)

Confirm that "bcompare" can be launched from the Terminal. Then enter
the following:

git config --global merge.tool bc

git config --global mergetool.bc.trustExitCode true

To launch a 3-way merge using Beyond Compare, use the command:

git mergetool file.ext

〆一缕阳光ご 2024-08-25 03:23:36

使用比 OP 更高版本的 Git 和 Beyond Compare,以下内容对我有用:

  • Git for Windows - v.2.22.0
  • Beyond Compare 4 - v.4.2.10(64 位版本)

要编辑的配置文件: %USERPROFILE%\.gitconfig

将 diff/difftool 和 merge/mergetool 标签替换为

[diff]
    tool = bc4
[difftool]
    prompt = false
[difftool "bc4"]
    cmd = \"c:/program files/beyond compare 4/bcomp.exe\" "$LOCAL" "$REMOTE"
[merge]
    tool = bc4
[mergetool]
    prompt = false
[mergetool "bc4"]
    trustExitCode = true
    cmd = \"c:/program files/beyond compare 4/bcomp.exe\" "$LOCAL" "$REMOTE" "$BASE" "$MERGED"

With later versions of Git and Beyond Compare than what OP had, the below is what worked for me:

  • Git for Windows - v.2.22.0
  • Beyond Compare 4 - v.4.2.10 (64-bit Edition)

Config file to be edited: %USERPROFILE%\.gitconfig

Replace the diff/difftool and merge/mergetool tags with

[diff]
    tool = bc4
[difftool]
    prompt = false
[difftool "bc4"]
    cmd = \"c:/program files/beyond compare 4/bcomp.exe\" "$LOCAL" "$REMOTE"
[merge]
    tool = bc4
[mergetool]
    prompt = false
[mergetool "bc4"]
    trustExitCode = true
    cmd = \"c:/program files/beyond compare 4/bcomp.exe\" "$LOCAL" "$REMOTE" "$BASE" "$MERGED"
下雨或天晴 2024-08-25 03:23:36

要在 MAC OSX 中使用 Beyond Compare,您需要执行以下操作:
从菜单中安装无与伦比的命令行工具:

在此处输入图像描述

然后您需要运行这些命令:

git config --global diff.tool bc3

git config --global merge.tool bc3
git config --global mergetool.bc3.trustExitCode true

之后,您可以在有 git 冲突的文件夹中运行 git mergetool ,BC 将按预期工作

To use beyond compare in MAC OSX you need to do the following:
Install beyond compare command-line tools from the menu:

enter image description here

Then you need to run those commands:

git config --global diff.tool bc3

git config --global merge.tool bc3
git config --global mergetool.bc3.trustExitCode true

After that, you could run git mergetool in the folder with git conflict and BC will work as expected

撧情箌佬 2024-08-25 03:23:36

这是我的配置文件。这花了一些功夫,但现在正在发挥作用。
我正在使用 Windows 服务器、msysgit 和 Beyond Compare 3(显然是 x86 版本)。您会注意到我不需要指定任何参数,并且我使用“path”而不是“cmd”。

[user]
        name = PeteW
        email = [email protected]
[diff]
        tool = bc3
[difftool]
        prompt = false
[difftool "bc3"]
        path = /c/Program Files (x86)/Beyond Compare 3/BComp.exe
[merge]
        tool = bc3
[mergetool]
        prompt = false
        keepBackup = false
[mergetool "bc3"]
        path = /c/Program Files (x86)/Beyond Compare 3/BComp.exe
        trustExitCode = true
[alias]
        dt = difftool
        mt = mergetool

Here is my config file. It took some wrestling but now it is working.
I am using windows server, msysgit and beyond compare 3 (apparently an x86 version). Youll notice that I dont need to specify any arguments, and I use "path" instead of "cmd".

[user]
        name = PeteW
        email = [email protected]
[diff]
        tool = bc3
[difftool]
        prompt = false
[difftool "bc3"]
        path = /c/Program Files (x86)/Beyond Compare 3/BComp.exe
[merge]
        tool = bc3
[mergetool]
        prompt = false
        keepBackup = false
[mergetool "bc3"]
        path = /c/Program Files (x86)/Beyond Compare 3/BComp.exe
        trustExitCode = true
[alias]
        dt = difftool
        mt = mergetool
不顾 2024-08-25 03:23:36

Beyond Compare 支持页面有点简短。

检查我的 diff.external 答案 了解更多(关于确切的语法)

摘录:

$ git config --global diff.external <path_to_wrapper_script>

在命令提示符处,替换为“git-diff-wrapper.sh”的路径,因此您的~/.gitconfig包含

-->8-(snip)--
[diff]
    external = <path_to_wrapper_script>
--8<-(snap)--

请务必使用正确的语法来指定包装器脚本和 diff 工具的路径,即使用正斜杠而不是反斜杠。就我而言,我有

[diff]
    external = c:/Documents and Settings/sschuber/git-diff-wrapper.sh

.gitconfig

"d:/Program Files/Beyond Compare 3/BCompare.exe" "$2" "$5" | cat

在包装脚本中。


注意:您还可以使用 git difftool

The Beyond Compare support page is a bit brief.

Check my diff.external answer for more (regarding the exact syntax)

Extract:

$ git config --global diff.external <path_to_wrapper_script>

at the command prompt, replacing with the path to "git-diff-wrapper.sh", so your ~/.gitconfig contains

-->8-(snip)--
[diff]
    external = <path_to_wrapper_script>
--8<-(snap)--

Be sure to use the correct syntax to specify the paths to the wrapper script and diff tool, i.e. use forward slashed instead of backslashes. In my case, I have

[diff]
    external = c:/Documents and Settings/sschuber/git-diff-wrapper.sh

in .gitconfig and

"d:/Program Files/Beyond Compare 3/BCompare.exe" "$2" "$5" | cat

in the wrapper script.


Note: you can also use git difftool.

狠疯拽 2024-08-25 03:23:36

看来 BC3 PRO 版只支持 3 路合并。
http://www.scootersoftware.com/moreinfo.php?zz=kb_editions

it looks like BC3 only supports 3 way merge for PRO Edition.
http://www.scootersoftware.com/moreinfo.php?zz=kb_editions

雪若未夕 2024-08-25 03:23:36

BC4 64 位更新:
这适用于 Windows v.2.16.2 和 Beyond Compare 4 - v.4.2.4(64 位版本)的 Git

我手动编辑了位于用户根目录“C:\Users\MyUserName”中的 .gitconfig 文件
并将 diff/difftool 和 merge/mergetool 标签替换为

[diff]
  tool = bc
[difftool "bc"]
  path = 'C:/Program Files/Beyond Compare 4/BComp.exe'
[difftool "bc"]
  cmd = \"C:/Program Files/Beyond Compare 4/BComp.exe\" \"$LOCAL\" \"$REMOTE\"
[difftool]
  prompt = false
[merge]
  tool = bc
[mergetool "bc"]
  path = 'C:/Program Files/Beyond Compare 4/BComp.exe'
[mergetool "bc"]
  cmd = \"C:/Program Files/Beyond Compare 4/BComp.exe\" \"$REMOTE\" \"$LOCAL\" \"$BASE\" \"$MERGED\"

Update for BC4 64bit:
This works for Git for Windows v.2.16.2 and Beyond Compare 4 - v.4.2.4 (64bit Edition)

I manually edited the .gitconfig file located in my user root "C:\Users\MyUserName"
and replaced the diff/difftool and merge/mergetool tags with

[diff]
  tool = bc
[difftool "bc"]
  path = 'C:/Program Files/Beyond Compare 4/BComp.exe'
[difftool "bc"]
  cmd = \"C:/Program Files/Beyond Compare 4/BComp.exe\" \"$LOCAL\" \"$REMOTE\"
[difftool]
  prompt = false
[merge]
  tool = bc
[mergetool "bc"]
  path = 'C:/Program Files/Beyond Compare 4/BComp.exe'
[mergetool "bc"]
  cmd = \"C:/Program Files/Beyond Compare 4/BComp.exe\" \"$REMOTE\" \"$LOCAL\" \"$BASE\" \"$MERGED\"
只为守护你 2024-08-25 03:23:36

如果您运行的是 Windows 7(专业版)和 Git for Windows(v 2.15 或更高版本),您可以简单地运行以下命令来了解您的 Git for Windows 支持哪些不同的 diff 工具

git difftool --tool-help

您将看到与此类似的输出

git difftool --tool=' 可以设置为以下之一:
维姆迪夫
vimdiff2
vimdiff3

这意味着你的 git 目前不支持(找不到)无法比较的 difftool 。

为了让 Git 找到 Beyond Compare 作为有效的 difftool,您的系统 path 环境变量中应该有 Beyond Compare 安装目录。您可以通过从 shell(cmd、git bash 或 powershell。我使用 Git Bash)运行 bcompare 来检查这一点。如果 Beyond Compare 未启动,请将其安装目录(在我的例子中为 C:\Program Files\Beyond Compare 4)添加到系统路径变量中。之后,重新启动 shell。 Git 将显示 Beyond Compare 作为可能的 difftool 选项。您可以使用以下任何命令将 Beyond Compare 作为 difftool 启动(例如,将任何本地文件与其他分支进行比较)。

git difftool -t bc branchnametocomparewith -- path-to-file
or 
git difftool --tool=bc branchnametocomparewith -- path-to-file

可以使用以下命令将 Beyond Compare 配置为默认 difftool

   git config --global diff.tool bc

您 。请记住,上面命令中的 bc 可以是 bc3 或 bc,具体取决于 Git 从路径系统变量中找到的内容。

If you are running windows 7 (professional) and Git for Windows (v 2.15 or above), you can simply run below command to find out what are different diff tools supported by your Git for Windows

git difftool --tool-help

You will see output similar to this

git difftool --tool=' may be set to one of the following:
vimdiff
vimdiff2
vimdiff3

it means that your git does not support(can not find) beyond compare as difftool right now.

In order for Git to find beyond compare as valid difftool, you should have Beyond Compare installation directory in your system path environment variable. You can check this by running bcompare from shell(cmd, git bash or powershell. I am using Git Bash). If Beyond Compare does not launch, add its installation directory (in my case, C:\Program Files\Beyond Compare 4) to your system path variable. After this, restart your shell. Git will show Beyond Compare as possible difftool option. You can use any of below commands to launch beyond compare as difftool (for example, to compare any local file with some other branch)

git difftool -t bc branchnametocomparewith -- path-to-file
or 
git difftool --tool=bc branchnametocomparewith -- path-to-file

You can configure beyond compare as default difftool using below commands

   git config --global diff.tool bc

p.s. keep in mind that bc in above command can be bc3 or bc based upon what Git was able to find from your path system variable.

我的痛♀有谁懂 2024-08-25 03:23:36

请注意您走错了 2 美元的路径。
因为您在 Cygwin 下,但 BC3 不在,所以您应该为其指定完整路径。例如“d:/cygwin$2”

请在此处参考我的 git-diff-wrapper.sh:

$ cat ~/git-diff-wrapper.sh
#!/bin/sh
echo $2
echo $5
/cygdrive/c/Program\ Files\ \(x86\)/Beyond\ Compare\ 3/BCompare.exe "d:/programs/cygwin$2" "$5"

祝你好运。

Please notice you make a wrong path of $2.
because you are under Cygwin but BC3 not, so you should specify a full path for it. such as "d:/cygwin$2"

Please refer my git-diff-wrapper.sh here:

$ cat ~/git-diff-wrapper.sh
#!/bin/sh
echo $2
echo $5
/cygdrive/c/Program\ Files\ \(x86\)/Beyond\ Compare\ 3/BCompare.exe "d:/programs/cygwin$2" "$5"

Good luck.

贱人配狗天长地久 2024-08-25 03:23:36

Windows 10,Git v2.13.2

我的 .gitconfig。请记住为'\'和'"'添加转义字符。

[diff]
    tool = bc4
[difftool]
    prompt = false
[difftool "bc4"]
    cmd = \"C:\\Program Files\\Beyond Compare 4\\BCompare.exe\" \"$LOCAL\" \"$REMOTE\"
[merge]
    tool = bc4
[mergetool "bc4"]
    path = C:\\Program Files\\Beyond Compare 4\\BCompare.exe

您可以参考将 Beyond Compare 设置为 difftool 以使用 git 命令进行配置。

Windows 10, Git v2.13.2

My .gitconfig. Remember to add escape character for '\' and '"'.

[diff]
    tool = bc4
[difftool]
    prompt = false
[difftool "bc4"]
    cmd = \"C:\\Program Files\\Beyond Compare 4\\BCompare.exe\" \"$LOCAL\" \"$REMOTE\"
[merge]
    tool = bc4
[mergetool "bc4"]
    path = C:\\Program Files\\Beyond Compare 4\\BCompare.exe

You may reference setting up beyond compare as difftool for using git commands to config it.

深空失忆 2024-08-25 03:23:36

在 Windows 10 上为我工作

在 git 终端中运行,

git config --global diff.tool bc3
git config --global difftool.bc3.path "c:/program files/beyond compare 4/bcomp.exe"
git config --global merge.tool bc3
git config --global mergetool.bc3.path "c:/program files/beyond compare 4/bcomp.exe"

Worked for me on Windows 10

Run in git terminal,

git config --global diff.tool bc3
git config --global difftool.bc3.path "c:/program files/beyond compare 4/bcomp.exe"
git config --global merge.tool bc3
git config --global mergetool.bc3.path "c:/program files/beyond compare 4/bcomp.exe"
甜宝宝 2024-08-25 03:23:36

为Beyond Compare 3运行以下命令(如果BCompare.exe路径在您的系统中不同,请根据您的系统替换它):

git config --global diff.tool bc3
git config --global difftool.bc3.cmd "\"c:/program files (x86)/beyond compare 3/BCompare.exe\" \"$LOCAL\" \"$REMOTE\""
git config --global difftool.prompt false

然后使用git difftool

Run these commands for Beyond Compare 3(if the BCompare.exe path is different in your system, please replace it according to yours):

git config --global diff.tool bc3
git config --global difftool.bc3.cmd "\"c:/program files (x86)/beyond compare 3/BCompare.exe\" \"$LOCAL\" \"$REMOTE\""
git config --global difftool.prompt false

Then use git difftool

℉服软 2024-08-25 03:23:36

区别在于被调用的 exe:将其设置为调用 bcomp.exe,它将正常工作。配置您的环境以调用 bcompare.exe,您最终会发现从修订系统中获取的比较部分是空的。

The difference is in the exe being called: set it up to call bcomp.exe and it'll work fine. Configure your environment to call bcompare.exe and you'll end up with the side of the comparison taken from your revision system being empty.

埋葬我深情 2024-08-25 03:23:36

无论出于何种原因,对我来说,由 git diff 创建的 tmp 文件在无法比较地打开之前就被删除了。我必须先将其复制到另一个位置。

cp -r $2 "/cygdrive/c/temp$2"
cygstart /cygdrive/c/Program\ Files\ \(x86\)/Beyond\ Compare\ 3/BCompare.exe "C:/temp$2" "$5"

For whatever reason, for me, the tmp file created by git diff was being deleted before it opened in beyond compare. I had to copy it out to another location first.

cp -r $2 "/cygdrive/c/temp$2"
cygstart /cygdrive/c/Program\ Files\ \(x86\)/Beyond\ Compare\ 3/BCompare.exe "C:/temp$2" "$5"
无言温柔 2024-08-25 03:23:36

对于MAC,经过大量研究后,它对我有用......!
1.安装Beyond Compare,它将安装在以下位置

/Applications/Beyond\ Compare.app/Contents/MacOS/bcomp

请按照以下步骤将 bc 制作为 git 中的 diff/merge 工具

For MAC after doing lot of research it worked for me..!
1. Install the beyond compare and this will be installed in below location

/Applications/Beyond\ Compare.app/Contents/MacOS/bcomp

Please follow these steps to make bc as diff/merge tool in git http://www.scootersoftware.com/support.php?zz=kb_mac

夜唯美灬不弃 2024-08-25 03:23:36

对于带有 BC2.exe 的 git 版本 2.15.1.windows.2。

下面的配置终于可以在我的机器上运行了。

<代码>[difftool“bc2”]
cmd = \"c:/program files/beyond Compare 2/bc2.exe\" ${LOCAL} ${REMOTE}

For git version 2.15.1.windows.2 with BC2.exe.

The config below finally works on my machine.

[difftool "bc2"]
cmd = \"c:/program files/beyond compare 2/bc2.exe\" ${LOCAL} ${REMOTE}

2024-08-25 03:23:36

如果你不想乱搞配置文件,你可以使用 difftool 的 --extcmd

因此,当我在计算机上进行比较时,我只需将其粘贴到我的 VSCode 终端中:

git difftool  --dir-diff --no-symlinks --extcmd "C:\Program Files\Beyond Compare 4\bcomp.exe" HEAD..master

无需配置。

If you don't want to muck around with config files, you can just use difftool's --extcmd.

So when I do compares on my computer, I just paste this into my VSCode terminal:

git difftool  --dir-diff --no-symlinks --extcmd "C:\Program Files\Beyond Compare 4\bcomp.exe" HEAD..master

No config required.

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