how to get only the deleted lines by git diff command?

Viewed 480

Is it possible to figure out only the deleted lines of a file by git diff command?

Currently git diff shows both the modified lines and deleted lines shown in the picture.

git diff

1 Answers

One way to do that using bash would be:

git diff | grep "^-[^-]" , it keeps only the lines starting with a - and do not have a second character - following, intended to avoid printing the files that contain the change.

Related