Get cumulative git scatter for multiple inconsistent commits

I would like to know if there is a way to get cumulative git diff for several non-sequential commits.

As an example, I can get what was changed in each commit using:

git diff 123456^ 123456 

Where "123456" is the git hash.

I can use this for several commits. But now I want to make several differences and combine the output into one.

As an example,

 git diff 123456^ 123456 git diff abcdef^ abcdef 

But combine diff into one. But "123456" and "abcdef" are not consecutive commits.

Update: Let's say the line in the xyz file has changed:

 In commit 123456: from "foo" to "bar" in commit abcdef: from "bar" to "oof" 

I just want to see him change from "foo" to "oof" after that to commit.

git diff 123456 abcdef does not work for me because I don't want all the changes between 123456 and abcdef.

I do not want to do anything; just want this to view the code for security.

+5
source share
2 answers

I'm sure someone has a smarter approach, but you can try squashing all the commits you have chosen into one, and then diff on that. You can do this by running the -cherry-pick command with -no-commit. Once you have the final result, you can git diff HEAD to get the difference with your base version (assuming you reset yourself to this place).

+2
source

git diff <commit-A> <commit-B> can generate diff between A and B , even if A and B are in different branches or from different repositories.

0
source

All Articles