如何配置'git diff'以使用emacs diff
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/1224005/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me):
StackOverFlow
How to configure 'git diff' to use emacs diff
提问by n179911
Is it possible to configure git diff to use emacs diff? If yes, can you please tell me how?
是否可以配置 git diff 以使用 emacs diff?如果是的话,你能告诉我怎么做吗?
Thank you.
谢谢你。
采纳答案by Karl Voigtland
See this question: how-do-i-view-git-diff-output-with-visual-diff-programfor information on git difftool.
请参阅此问题:how-do-i-view-git-diff-output-with-visual-diff-program有关git difftool 的信息。
You can also use git from within emacs: EmacsWiki: Git.
您还可以在 emacs 中使用 git: EmacsWiki: Git。
回答by Henrik Paul
It seems to be possible, according to the Pro Gitbook.
根据Pro Git 的书,这似乎是可能的。
See chapter 7.1for more information, but the quick'n'dirty of it seems to be
有关更多信息,请参阅第 7.1 章,但它的快速性似乎是
$ git config --global diff.external [your favorite differ here]
or, if you want it to your ~/.gitconfig
或者,如果你想要它 ~/.gitconfig
[diff]
external = [your favorite differ here]
回答by Pinochle
If you are working within Emacs, you could advicevc-git-diff
(the function is found in vc-git.elfor reference), to give you the option of using either git-diff or emacs-diff according to your whim (and it wouldn't require you "forking" the git library that comes bundled with Emacs).
如果您在 Emacs 中工作,您可以提出建议vc-git-diff
(该函数可在vc-git.el 中找到以供参考),根据您的想法为您提供使用 git-diff 或 emacs-diff 的选项(它不会要求您“分叉”与 Emacs 捆绑在一起的 git 库)。
回答by Cascabel
Assuming you mean git-diff, not git-difftool, you are probably looking for the diff.external
config option. You'll want to look at the git Diffs section of git(1). This section doesn't mention the config setting, though it's listed in git-config(1).
假设您的意思是 git-diff,而不是 git-difftool,您可能正在寻找diff.external
config 选项。您需要查看git(1)的 git Diffs 部分。本节没有提到配置设置,尽管它在git-config(1) 中列出。
回答by justingordon
Another possibility is to use use
另一种可能性是使用 use
M-x term
Which will bring up a terminal inside of emacs which supports the page.
这将在 emacs 中打开一个支持该页面的终端。
You can also do
你也可以这样做
$ git diff <your file> | cat
You can also open up the file and do M-x vc-diff.
您也可以打开文件并执行 Mx vc-diff。