与“git difftool--dir diff”相比,它遇到了一个关于符号链接的问题

与“git difftool--dir diff”相比,它遇到了一个关于符号链接的问题,git,diff,beyondcompare,Git,Diff,Beyondcompare,设置新的git repo并添加一些文件: [Feb-09 18:35][Desktop]$ mkdir exampleForStackOverflow [Feb-09 18:35][Desktop]$ cd exampleForStackOverflow/ [Feb-09 18:35][exampleForStackOverflow]$ git init Initialized empty Git repository in ~/Desktop/exampleForStackOverflow/

设置新的git repo并添加一些文件:

[Feb-09 18:35][Desktop]$ mkdir exampleForStackOverflow
[Feb-09 18:35][Desktop]$ cd exampleForStackOverflow/

[Feb-09 18:35][exampleForStackOverflow]$ git init
Initialized empty Git repository in ~/Desktop/exampleForStackOverflow/.git/

[Feb-09 18:35][exampleForStackOverflow]$ touch foo.txt
[Feb-09 18:35][exampleForStackOverflow]$ touch bar.txt
[Feb-09 18:35][exampleForStackOverflow]$ touch baz.txt

[Feb-09 18:36][exampleForStackOverflow]$ git add *

[Feb-09 18:36][exampleForStackOverflow]$ git commit -m "Create files"
[master (root-commit) 42bfa60] Create files
 3 files changed, 0 insertions(+), 0 deletions(-)
 create mode 100644 bar.txt
 create mode 100644 baz.txt
 create mode 100644 foo.txt
修改文件:

[Feb-09 18:37][exampleForStackOverflow]$ echo "Foo" > foo.txt 
[Feb-09 18:37][exampleForStackOverflow]$ echo "Bar" > bar.txt 
[Feb-09 18:37][exampleForStackOverflow]$ echo "Baz" > baz.txt
当前状态:

[Feb-09 18:38][exampleForStackOverflow]$ git status
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:   bar.txt
    modified:   baz.txt
    modified:   foo.txt

no changes added to commit (use "git add" and/or "git commit -a")
现在,通过bcompare,我得到以下信息:

[Feb-09 18:38][exampleForStackOverflow]$ git difftool --dir-diff

这显然不是预期的行为。文件不对齐,因此无法看到差异


我正在跑步:

[Feb-09 18:44][exampleForStackOverflow]$ git --version
git version 2.7.1

[Feb-09 18:44][exampleForStackOverflow]$ cat /etc/redhat-release 
CentOS release 6.6 (Final)
无与伦比:
4.1.3版(build 20814)

git配置:

[Feb-09 18:45][exampleForStackOverflow]$ git config --list
color.ui=true
user.name=FOO
user.email=BAR@BAZ.com
log.decorate=full
diff.tool=bc3
difftool.bc3=trustExitCode
merge.tool=bc3
mergetool.bc3=trustExitCode
core.repositoryformatversion=0
core.filemode=true
core.bare=false
core.logallrefupdates=true


问题:(From)这与符号链接有什么关系

回答:很抱歉,屏幕截图不太清晰,但右侧的文件是符号链接。见下文:

[Feb-09 18:52][exampleForStackOverflow]$ cd /tmp/git-difftool.RWDqE/right
[Feb-09 18:52][right]$ ll
total 0
lrwxrwxrwx 1 BAZ BAZ_g 54 Feb  9 18:51 bar.txt -> /home/BAZ/Desktop/exampleForStackOverflow/bar.txt
lrwxrwxrwx 1 BAZ BAZ_g 54 Feb  9 18:51 baz.txt -> /home/BAZ/Desktop/exampleForStackOverflow/baz.txt
lrwxrwxrwx 1 BAZ BAZ_g 54 Feb  9 18:51 foo.txt -> /home/BAZ/Desktop/exampleForStackOverflow/foo.txt
使用该方法将起到以下作用:

git difftool --dir-diff --no-symlinks
从:

--[否-]符号链接

git difftool的默认行为是创建指向工作树的符号链接 在--dir diff模式和比较的右侧运行时 生成与工作树中的文件相同的内容

指定--无符号链接指示git difftool创建副本 相反--Windows上默认没有符号链接


除了sixtyfootersdude的建议之外,另一个选择是制作超越比较的跟随符号链接。这将使符号链接与同名文件对齐

在“比较”文件夹中,单击“规则”工具栏按钮(裁判图标)。 转到处理选项卡。 选中“跟随符号链接”

要使其影响所有新会话,请将对话框底部的下拉列表从“仅用于此视图”更改为“同时更新会话默认值”,然后单击“确定”


快照:


这与符号链接有什么关系?@IsmailBadawi:UpdatedNice。我更喜欢这个解决方案。我在Bcompare中查找此选项,但找不到。既然你为scooter工作:为什么顶部菜单上的“规则”按钮不可用?可能在Windows或Linux上的“工具”下,从顶部菜单打开“会话>会话设置”,然后转到“比较”选项卡,到达与“规则”工具栏按钮相同的位置。在Mac上,菜单项是“无法比较>会话设置”。谢谢!如果你想要一个所有更改文件的简单列表,请记住选择“忽略文件夹结构”。这对于查看差异非常有效。但请注意,此方法不允许您编辑文件(因为它们只是临时副本)。
git difftool --dir-diff --no-symlinks