view raw
Yama Yama - 6 months ago 29
Git Question

How can I find added lines (not changed) using git diff?

I've got a changelog text file in a project. I want to get list of changes from this file between 2 tags. I prepared this command:

git diff tag1..tag2 file | grep -v -e "+++ b/file" -e "@@" | grep "+"

As an output I receive all lines marked as added (beginning with
). But between them there might be some lines existed earlier, but modified between mentioned tags (for examplet corrected misspellings). Is there any option which allow to filter only new lines or only modified lines? Or maybe any option which allow to control the % condition of line's modification to be printed in output?


Unfortunatelly I couldn't find any satisfying answer (nor here neither anywhere else), so I had to write necessary script myself.