2

Someone git push --force and I get merge conflict.

Comparing local and remote branches I can see that (1) last two commits are replaced by (2) only one. And new 242ab72 commit was added.

enter image description here

Now I want to analyze how commit 5892f6b differs from 6a53778 commit.

Is there something similar to next command?

diff -ruBN $(git show 6a53778) $(git show 5892f6b)

NOTICE: I do not want to see difference what is changed between 6a53778 and 5892f6b.
I want to compare how content of these two commits differ to each other.

Eugen Konkov
  • 22,193
  • 17
  • 108
  • 158

2 Answers2

2

Git 2.19 introduces a new command, git range-diff which does this:

git-range-diff - Compare two commit ranges (e.g. two versions of a branch)

See details here

example of git range-diff 94516fd0...a22765c4

enter image description here

Eugen Konkov
  • 22,193
  • 17
  • 108
  • 158
  • Could you replace the picture with text please? Pictures are not accessible to blind readers. – fuz Jul 04 '22 at 15:57
1

I found this good answer:

diff -ruBN <(git show 6a53778) <(git show 5892f6b)

UPD
Also I found this:

[alias]
        intercommit = !sh -c 'interdiff <(git show $1) <(git show $2) | less -FRS' 

NOTICE
interdiff may cause error:

interdiff: Error applying patch1 to reconstructed file

This occur because interdiff doesn't have the advantage of being able to look at the files that are to be modified.

Eugen Konkov
  • 22,193
  • 17
  • 108
  • 158