我正在使用Git for Windows,并使用xltrail扩展程序,以便在使用
然而,当我运行
git diff <Excel工作簿>
时提供可读的输出。 我还使用图形化的diff / merge工具Beyond Compare 4 Pro,当使用git difftool
时运行,并提供一个漂亮的并排差异和三向合并界面。然而,当我运行
git difftool <Excel工作簿>
时,我会得到正常的git diff
输出,而没有提示打开Beyond Compare。如何让Git、xltrail和Beyond Compare一起工作?
编辑 #1
以下是此问题的完整示例:$ git config diff.tool; git config difftool.bc.path; git config difftool.prompt
bc
c:/Program Files/Beyond Compare 4/bcomp.exe
false
$ cat .git/config
[core]
repositoryformatversion = 0
filemode = false
bare = false
logallrefupdates = true
symlinks = false
ignorecase = true
[diff "xltrail"]
command = git-xltrail-diff.exe
[merge "xltrail"]
name = xltrail merge driver for Excel workbooks
driver = git-xltrail-merge.exe %P %O %A %B
$ cat ~/.gitconfig
# This is Git's per-user configuration file.
[user]
name = Andrew Keeton
email = AKeeton@example.com
[push]
default = simple
[alias]
co = checkout
ci = commit
cam = commit -am
st = status
br = branch
# short log
shlog = log --pretty=format:\"%C(yellow bold)%h%Creset %ad %C(cyan)|%Creset %s%C(magenta)%d%Creset %C(bold)[%an]%Creset\" --date=short --name-only
hist = log --pretty=format:\"%C(yellow bold)%h%Creset %ad %C(cyan)|%Creset %s%C(magenta)%d%Creset %C(bold)[%an]%Creset\" --date=short --graph
[diff]
tool = bc
[difftool "bc"]
path = c:/Program Files/Beyond Compare 4/bcomp.exe
[difftool]
prompt = false
$ git st
On branch master
Changes not staged for commit:
(use "git add <file>..." to update what will be committed)
(use "git checkout -- <file>..." to discard changes in working directory)
modified: workbook.xlsm
modified: README.md
no changes added to commit (use "git add" and/or "git commit -a")
$ git diff README.md
diff --git a/README.md b/README.md
index a052e20..3fd700d 100644
--- a/README.md
+++ b/README.md
@@ -40,6 +40,11 @@
## Tips
+* Lorem ipsum dolor sit amet, consectetur adipiscing elit.
+* Curabitur a dui eu massa feugiat varius tempor eget tellus.
+* Nullam et fringilla eros.
+* Etiam euismod ipsum enim, non molestie nunc varius eu.
+
* In Excel, press `CTRL+G` to open the *Go To* window. This makes it easy to find the various tables and "anchors."
## xltrail
$ git difftool README.md
<See screenshot of README.md in Beyond Compare 4>
$ git diff workbook.xlsm
diff --xltrail a/workbook.xlsm b/workbook.xlsm
--- a/workbook.xlsm/VBA/Module/modWorksheet
+++ b/workbook.xlsm/VBA/Module/modWorksheet
@@ -14,6 +14,7 @@
Dim dDouble1 As Double
Dim dDouble2 As Double
Dim dDouble3 As Double
+ Dim sString1 As String
Dim dDouble4 As Double
Dim iInteger1 As Integer
$ git difftool workbook.xlsm
diff --xltrail a/workbook.xlsm b/workbook.xlsm
--- a/workbook.xlsm/VBA/Module/modWorksheet
+++ b/workbook.xlsm/VBA/Module/modWorksheet
@@ -14,6 +14,7 @@
Dim dDouble1 As Double
Dim dDouble2 As Double
Dim dDouble3 As Double
+ Dim sString1 As String
Dim dDouble4 As Double
Dim iInteger1 As Integer
git difftool
(但是启用提示),因此当我执行git difftool README.md
时,我会得到Viewing (1/1): 'README.md'\n Launch 'bc' [Y/n]?
,然后它会使用适当的并排差异在 Beyond Compare 中打开。 - Andrew Keetonprompt
改成了false
,但我不认为这会有影响。请参见我原帖中的 编辑 #1。 - Andrew Keeton