【发布时间】:2011-11-24 10:42:57
【问题描述】:
我想让git diff 为我输出除 *.tex 之外的所有文件的常规差异。对于 *.tex 文件,我想查看git diff --word-diff 的输出。
我一直在玩 .gitattributes 和 .gitconfig,但我得到的最大结果是获得一个 .tex 文件的部分显示,然后是崩溃。
是否有可能获得这种行为?
我的.gitattributes:
*.tex diff=latex
.gitconfig:
[diff "latex"]
wordRegex = "\\\\[a-zA-Z]+|[{}]|\\\\.|[^\\{}[:space:]]+"
command = ~/bin/word-diff.sh
和word-diff.sh:
#!/bin/sh
git --no-pager diff --color-words "$2" "$5"
【问题讨论】:
-
你是怎么想出“$2”和“$5”的?我在任何地方都找不到这方面的信息。
-
找到了,抱歉。对于其他想知道的人,请在 git man page 中搜索 GIT_EXTERNAL_DIFF。
-
顺便说一句,supposed to be 有一个内置的差异模式“tex”可用,它应该给你合理的大块头。但这似乎对我不起作用。
标签: git word-diff gitattributes