0

I'm trying to figure out the best way to track the ways the lines in a given text file change from commit to commit, in hopes that I can give them unique IDs (which is a whole other hullaballoo for another time)...

Ideally, I'm looking for some sort of data equal to the visual representation in the change log view -- where I can easily see, ok:

  • line 1 -> line 1
  • line 2 -> line 2
  • _____ -> line 3 NEW
  • line 3 -> _______REMOVED
  • line 4 -> _______REMOVED
  • line 5 -> becomes line 4

etc etc

The change log visually contains what I'm looking for:

The change log visually contains what I'm looking for in this clip...

My knowledge of git & sourcecontrol is functional but this is definitely pulling me into the deep end and I haven't found anyone looking for this exact same thing (which makes me worry I might be taking the wrong approach but...)

What I've tried so far is git diff (--stat, --numstat) but have only found the amount of lines added and removed, as per this question about finding the # of lines changed with diff Somehow that led me to leaning about patch files, and seeing if I can pull the info out of there, which might be do-able if i write a thing to process and calculate the line changes (which might be what I end up having to do...)

Is there is a command line that goes to this level of change log detail? I can conceptualize how I could calculate this by iterating through each patch line, checking if an addition or subtraction has been made, and applying that to the count of the line, but first i thought i'd make sure it isn't doable with command.

thanks in advance!

rkta
  • 3,959
  • 7
  • 25
  • 37

1 Answers1

0

It depends a bit on what you are trying to achieve. I used perforce for many years before using git. One command I have not found a full substitute for is, p4 annotate -a .... I have not found a way to find deleted lines using git blame ....

That said, I have made good use of git log -p ... to search through the full text of several patches to find changes to specific lines of code.

Timothy Prime
  • 136
  • 1
  • 11