For "git diff" is there a -U<infinity> option to show the whole file?

git

Solution

If you just use a large number with `-U`, you could choose the large number to be the point at which your application can't handle displaying such a large file (diff).

it's a correctness issue if my file is larger than 1M lines

And to address this issue, you can check the output for more than one `@@ ... @@` line to determine whether it's complete — this allows you to avoid silently giving a wrong number.

Problem

I need to generate a full-context git diff programmatically for a web ui. A CLI for generating a full-context diff was covered in questions: - How to get git diff with full context? - Git show whole file changes The prevalent answer is something like `git diff -U99999` With a `-U / --unified` option with a ridiculously high threshold (e.g. 999,999), doing `git diff -U999999`: - Makes me suspect that there could be a performance hit - Even worse, it's a correctness issue if my file is larger than 1M lines Is there a -U option to show the whole file?

Original source

Related problems