13

I want to increase no of lines displayed Before and After changes in git diff output.

Analogous to grep -A3 -B5 ...

Bharat Pahalwani
  • 1,235
  • 3
  • 22
  • 38

2 Answers2

9

According to git diff --help, git diff supports the same arguments as the standard diff command w/r/t context:

   -U<n>, --unified=<n>
       Generate diffs with <n> lines of context instead of the usual three. Implies
       -p.
larsks
  • 228,688
  • 37
  • 348
  • 338
  • 2
    Note the question suggested different before/after line counts (`-A3 -B5`) and `-U` doesn't support that. – Mu Mind Feb 16 '17 at 06:33
7

You can use the -U switch to control the number of lines of context around the diff:

$ git diff -U5
Mureinik
  • 277,661
  • 50
  • 283
  • 320