git restore file from previous commit

You can use git checkout command to restore/revert a file to an older version using the previous git commit.


Create a new git local repository:

Create a file and add some changes each time committing them:

Check the current content of the file and git log:

Restore file from previous commit in git:

Leave a Reply