tuhin47
tuhin47

Reputation: 6058

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

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

Upvotes: 4

Views: 2722

Answers (1)

Zois Tasoulas
Zois Tasoulas

Reputation: 1553

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.

Upvotes: 4

Related Questions