0

In a recent refactoring, I split file a.txt into b.txt and c.txt in branch1, and split it into c.txt and d.txt in branch2. When diffing, Git interprets such a split as moving e.g. a.txt to b.txt (since they have more content in common) with changes, and adding c.txt as a new file.

How can I git diff files with different names from different commits? e.g. How can I diff these with each other?

  • b.txt from branch1
  • d.txt from branch2
3
  • does using git diff -M3 give git enough hints to follow moves? Commented Feb 2, 2020 at 20:00
  • 1
    maybe this might help you with your problem stackoverflow.com/a/16683184/8776411 Commented Feb 2, 2020 at 20:07
  • @NiklasKlausberger yes, the 2nd option on the linked answer is what I was looking for. git diff branch1:b.txt branch2:d.txt in my example. (Except the linked answer doesn't specify both branches, as does the one it links to.) Thanks! Commented Feb 2, 2020 at 20:17

0

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.