如何获得具有完整上下文的git diff? [英] How to get git diff with full context?
问题描述
如何创建适合在坩埚中查看的补丁?
git diff分支大师 - 无前缀> patch
这只产生3行上下文。所以我做了以下操作:
git diff --unified = 2000 branch master --no-prefix>补丁
希望所有文件的行数少于2000行。有没有办法告诉git在补丁文件中包含所有行而不必指定最大行数?
知道这是旧的,但我也不喜欢硬编码的解决方案,所以我测试了这一点:
git diff -U $(wc -l MYFILE)
使用-U似乎是解决此问题的唯一方法,但使用行计数承诺,它将适用于一个非常大的文件中的一个小的变化。
How to create patch suitable for reviewing in crucible?
git diff branch master --no-prefix > patch
This generates only 3 lines of context. So I do the following
git diff --unified=2000 branch master --no-prefix > patch
Hopefully all files will have less than 2000 lines. Is there a way to tell git to include all the lines in the file for patch without having to specify maximum lines?
I know this is old, but I also dislike hard-coded solutions, so I tested this:
git diff -U$(wc -l MYFILE)
Using -U seems to be the only way to approach the issue, but using a line count promises that it will work for even a small change in a very large file.
这篇关于如何获得具有完整上下文的git diff?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!