Search code examples
gitloggingdiffblame

How to see deleted changes between commits


I am using a repository for a tex files. By using wrong software I have now inconsistent files.

My question is how to see deleted changes between commits. I have narrowed the problem down to about 30 commits in 3 branches. Between those I would like to see the changes to all files in all lines. Especially those lines were added but later disappeared.

Sadly I have whole paragraph in one line, so I may need the word comparison instead of line as well.

Let say I have commits:

  • Comm5

  • Comm4

  • Comm3
  • Comm2
  • Comm1

and I want to see the added lines between Comm1 and Comm5 that has not existed in Comm1 and no longer exist in Comm5

I am ok, with the result where I would have all lines duplicated and I would have to manually correct them, I just don't want to miss anything.

Any Advice?


Solution

  • Assuming the commits are contiguous, git log's --patch option can be useful here:

    git log --patch commit1 commit5
    

    will show commit messages alongside diffs for each commit.

    Alternatively, it might be better to constrain by file instead of by commit:

    git log --patch -- my-file.tex