Depending on what I am diff
ing sometimes I want to see several lines (let's say 10) above and below the +
insertions -
deletions, sometimes I just want to see a couple of lines surrounding them.
Is there a way to tell git the number of line he should show me?
When viewing a combined diff, if the two files you're comparing have a line that's different from what they were merged into, you will see the ++ to represent: one line that was added does not appear in either file1 or file2.
git diff --cached --merge-base A is equivalent to git diff --cached $(git merge-base A HEAD) . This form is to view the changes you have in your working tree relative to the named <commit>. You can use HEAD to compare it with the latest commit, or a branch name to compare with the tip of a different branch.
^M represents carriage return. This diff means something removed a Unicode BOM from the beginning of the line and added a CR at the end.
The option you're looking for is -U
. From the man page:
-U<n>, --unified=<n>
Generate diffs with lines of context instead of the usual three. Implies -p.
git diff -U<num>
. Default is 3.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With