FUNDAMENTAL

How to check file changes in a commit

Sometimes, you committed some changes in git locally. Now you missed that where you have committed the right changes or not. You That specific detail that you wanted to change, whether you have correcty done it or not.

You also don't want to do reset the commit because it might take time and you just want to verify the changes because while committing a change, you were in hurry.

If you the commit hash, you can check file changes easily.

Follow these steps:

  1. Find the commit hash:

    Use this commond to find the commit hash

    git log
  2. Now check file changes:

    Use git diff command to check file changes

    git diff commithash^!

    As you can see, ^! is appended to the commit hash.

    e.g.

    git diff 4eb3fcc0ca8e7e9dbacf686222b853531217c1b5^!

Now you check file changes easily.

That's all.