Diff between two commits

Asked

Viewed 649 times

3

I’m making a git diff between two commits and in general it shows me the difference between the files that were modified in these commits.

EX:

git diff 1a1a1a 4d4d4d

+              Essa linha foi adicionada
-              Essa linha foi removidada

This works perfectly, and I have nothing to complain about. The point is that among these commits there are other commits! And it’s exactly them I want.

Ex:

commit 1a1a1a
Author: Gabriel Hardoim

     Commit 1A

commit 2b2b2b
Author: Gabriel Hardoim

     Commit 2B      // Esse commit me interessa

commit 3c3c3c
Author: Gabriel Hardoim

     Commit 3C      // Esse também

commit 4d4d4d
Author: Gabriel Hardoim

     Commit 4D

With that in mind, how can I make a for each between the first and last commit? git has some command that can help me in this case?

1 answer

2


Use the .. between the commits:

git diff 1a1a1a..4d4d4d

Or:

git diff 1a1a1a^..4d4d4d

Whether to include initial commit differences 1a1a1a.

Without the .., you take only the differences between only the two commits and not all commits between them.

Browser other questions tagged

You are not signed in. Login or sign up in order to post.