Git diff经常认为微小的变化是非常大的变化,并且没有正确识别次要变更的代码。
是否有一种简单的方法可以通过添加源代码中的某个标记来帮助git,或者可能采用其他方式?
git diff
提供各种方法来忽略微小的变化:
git diff
的提示,不是在文件本身,而是在.gitattributes
文件中。
例如,参见“Is there a way to ask git diff
to show the method name instead of the class name?”。然而,这是局部差异。 对于GitHub,没有本机解决方案强制它在文件“太大”时显示差异。
类似的情况(仍然在GitHub上)是reported here,当看到
Sorry, we could not display the entire diff because too many files changed
我正在通过将diff文件下载到本地来解决方法,但是通过这种方式我没有像GitHub PR中那样的diff突出显示功能。
Adding .patch
at the end of the diff GitHub URL can help a bit。