Step 1: Check all commits via log command:
git log
Step 2: You can review the changes made to a file using the below command:
git diff <commit hash> <filename>
Step 3: Then, revert a specific file to that commit using the below command:
git reset <commit hash> <filename>
Note: You may need to use the --hard option if you are not able to run the above commands then "--hard" will help you in local modifications.
To revert to the last committed version in the repo, you can use the below command:
git checkout HEAD file/to/restore
Comments
Post a Comment