Git Directory Diff在我的子模块中不起作用 [英] Git Directory Diff does not work in my submodule
本文介绍了Git Directory Diff在我的子模块中不起作用的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我正在使用Git 1.8.4和Linux(Kubuntu 13.10).
I am using Git 1.8.4 and Linux (Kubuntu 13.10).
我有一个带有子模块的Git存储库.如果我在主Git模块中要求目录diff,它可以正常工作.如果我在其中一个子模块中执行相同的操作,则会收到错误消息:
I have a Git repository with submodules. If I ask for directory diff in the main Git module, it works fine. If I do the same in one of the submodules, I get an error:
~/Projects/MAINMODULE/platform/SUBMODULE [master]$ git difftool -tool=meld --dir-diff --cached
fatal: Could not switch to '../../../../platform/': No such file or directory
diff --raw --no-abbrev -z --cached: command returned error: 128
~/Projects/MAINMODULE/platform/SUBMODULE [master]$ cd ..
~/Projects/MAINMODULE/platform [master]$ cd ..
~/Projects/MAINMODULE [master]$ git difftool -tool=meld --dir-diff --cached
// NO PROBLEM, works.
~/Projects/MAINMODULE [master]$ git version
git version 1.8.4
你有什么主意吗?可能是Git Bug吗?
Do you have any idea? May it be a Git Bug?
更新:1.8.5.3产生相同的输出
UPDATE: 1.8.5.3 produces the same output
推荐答案
此替代方法对我有效:
GIT_WORK_TREE="$(git rev-parse --show-toplevel)" GIT_DIR="$(git rev-parse --git-dir)" git difftool --tool=meld --dir-diff
您当然可以按照您的示例放入--cached.
You can of course put in --cached as per your example.
要键入很多,因此您可以将以下别名添加到~/.gitconfig
:
That's quite a lot to type so you can add the following alias to your ~/.gitconfig
:
[alias]
submeld = !git --work-tree "$(git rev-parse --show-toplevel)" --git-dir "$(git rev-parse --git-dir)" difftool --tool=meld --dir-diff
这篇关于Git Directory Diff在我的子模块中不起作用的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文