How to compare different patches of same commit with git diff

0 votes

Consider the following scenario when running this line of code on a feature branch in git:

file path/* || echo Changed git diff —quiet master feature

If any file in the specified file path changes, the first statement will exit with a 0 value. The next command to the right will then echo "Changed" to indicate that there have been changes to the master branch.

I'd like to do something similar, but in the context of comparing a commit to itself in relation to previous amendments.

So, if I have commit A (patch 1), make a change, and run "git commit —amend," the commit is amended, and we'll call it B. (patch 2). The first patch will be A, and the second patch will be B. (as it will typically be in Gerrit).

Is it possible to compare the two patches and see which files have changed since the last "git commit —amend" command?

So, ideally, I'd like to use something like "git diff" to compare patch X relative to patch Y of a commit that specifies changed or updated files.

Jan 4, 2023 in DevOps on Cloud by Damonlang
• 1,230 points

edited 5 days ago 17 views

No answer to this question. Be the first to respond.

Your answer

Your name to display (optional):
Privacy: Your email address will only be used for sending these notifications.
webinar REGISTER FOR FREE WEBINAR X
REGISTER NOW
webinar_success Thank you for registering Join Edureka Meetup community for 100+ Free Webinars each month JOIN MEETUP GROUP