运行“git difftool”在Git Bash中打开了Visual Studio的多个空实例 [英] Running "git difftool" at Git Bash opens up multiple, empty instances of Visual Studio
问题描述
git difftool mybranch master
git打开了一个接一个的Visual Studio的几个空实例(没有文件打开,没有显示差异)。
以下是我的主目录中全局 .gitconfig
的相关部分:
[diff]
工具= vsdiffmerge
[difftool]
提示符= false
[difftoolvsdiffmerge]
cmd ='C:/ Program Files(x86)/ Microsoft Visual Studio 12.0 / Common7 / IDE / vsdiffmerge.exe'$ LOCAL$ REMOTE// t
keepbackup = false
trustexistcode = true
我从此链接,它描述了如何在git中使用内置的Visual Studio diff工具。
我的理论是 vsDiffMerge.exe
正在使用错误的参数调用。
我已经尝试为 vsDiffMerge.exe
创建包装 .sh
脚本:
#!/ bin / sh
C:/ Program Files(x86)/ Microsoft Visual Studio 12.0 / Common7 / IDE / vsDiffMerge .exe$ 2$ 5
并将其设置为我的,像这样:
[diff]
external =(我的shell包装的路径)
但是这与我目前的工作有相似的效果,除了它只是打开了一个Visual Studio实例,并且必须使用 git diff
而不是 git difftool
来运行。
任何帮助都将非常感谢 - 我一直无法找到有关此问题的相关信息。 解决方案
我不确定我以前的配置无法正常工作的确切原因,但现在这个工作对我来说很重要: $ b
在我的 .gitconfig中
:
[diff]
工具= vsDiffMerge
[difftoolvsDiffMerge]
cmd ='C:/ Program Files(x86)/ Microsoft Visual Studio 12.0 / Common7 / IDE / vsDiffMerge.exe'$ LOCAL $ REMOTE
trustExitCode = true
我不再需要shell包装脚本,并且可以成功查看差异:
git difftool mybranch master
When I run the following command in Git Bash:
git difftool mybranch master
git opens up several empty instances (no files open, no diff shown) of Visual Studio, one after another.
Here's the relevant portion of my global .gitconfig
, located in my home directory:
[diff]
tool = vsdiffmerge
[difftool]
prompt = false
[difftool "vsdiffmerge"]
cmd = '"C:/Program Files (x86)/Microsoft Visual Studio 12.0/Common7/IDE/vsdiffmerge.exe"' "$LOCAL" "$REMOTE" //t
keepbackup = false
trustexistcode = true
I got this snippet from this link, which describes how to use the built-in Visual Studio diff tool with git.
My theory is that vsDiffMerge.exe
is being called with the wrong parameters.
I've already tried creating a wrapper .sh
script for vsDiffMerge.exe
:
#!/bin/sh
"C:/Program Files (x86)/Microsoft Visual Studio 12.0/Common7/IDE/vsDiffMerge.exe" "$2" "$5"
and setting it as an external tool in my .gitconfig
, like this:
[diff]
external = (path to my shell wrapper)
but this had a similar effect to my current efforts, except that it only opened a single instance of Visual Studio, and had to be run with git diff
instead of git difftool
.
Any help would be much appreciated - I haven't been able to find much relevant information on this issue.
I'm not sure the exact reason why my previous configuration wasn't working, but this is now working for me:
In my .gitconfig
:
[diff]
tool = vsDiffMerge
[difftool "vsDiffMerge"]
cmd = "'"C:/Program Files (x86)/Microsoft Visual Studio 12.0/Common7/IDE/vsDiffMerge.exe"' $LOCAL $REMOTE"
trustExitCode = true
I no longer need the shell wrapper script, and I can successfully view diffs like so:
git difftool mybranch master
这篇关于运行“git difftool”在Git Bash中打开了Visual Studio的多个空实例的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!