I've looked for the answer but couldn't find it on stackoverflow, so I ask it here.
Let's assume I have some local changes since the last commit(and push) and I want to git diff of a file between a specific commit(several commits ago) and my current local version.
I mean, for example, I can see the difference of a file between two specific commits by
git diff COMMIT1 COMMIT2 src/testsuites/file1.c
But I want to see the difference between COMMIT1 and local file. How do you do that?
Per the git docs:
git diff [--options] <commit> [--] [<path>…] This form is to view the changes you have in your working tree relative to the named <commit>. You can use HEAD to compare it with the latest commit, or a branch name to compare with the tip of a different branch.
So you would just do git diff COMMIT1 src/testsuites/file1.c
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With