For “git diff” is there a -U option to show the whole file?

前端 未结 2 2045
挽巷
挽巷 2021-01-04 03:54

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 ge
2条回答
  •  死守一世寂寞
    2021-01-04 04:11

    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.

提交回复
热议问题