Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

change no of lines after and before in git diff output

Tags:

git

git-diff

I want to increase the number of lines displayed before and after changes in git diff output.

Analogous to grep -A3 -B5 ...

like image 302
Bharat Pahalwani Avatar asked Jul 28 '16 13:07

Bharat Pahalwani


2 Answers

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

$ git diff -U5
like image 69
Mureinik Avatar answered Oct 31 '22 06:10

Mureinik


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.
like image 33
larsks Avatar answered Oct 31 '22 05:10

larsks