Git Diff with Beyond Compare

前端 未结 17 2079
醉酒成梦
醉酒成梦 2020-11-30 16:39

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 ver

17条回答
  •  温柔的废话
    2020-11-30 17:22

    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.

提交回复
热议问题