I need to investigate a project, with a patch made by a former student of my university. He made a series of commits on a repo, and I need to see what additions he made.

I got the list of files modified with git diff --name-status <hash>.

Now I want to use Magit to see, in a file, all the lines added by the student. Since his commits are all continuous, and end at HEAD, I figured out I could use Ediff range, so: E r <initial-commit>. Now, my question is: is there a better, more specific way to do that?

I'm interested, in particular, in having the inserted lines highlighted, while still being able to see the other ones. Ediff does that, but then I need to expand the window, and make the buffer read-only for safety. I also thought of git blame (C-c M-g b) but then I see all the commits, not just the range I'm interested in. Maybe something like git blame, but for ranges? Is it possible to do so in Magit?

Thanks for your time!

EDIT: git diff <initial commit>..HEAD on the other hand, effectively shows the additions, but I can't read the rest of the file, unless I set an overshooting -U (context) parameter, and in any case it's not as comfortable as git blame.


Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.