Is there a way to revert to a previous commit in VS code?

Provided that you have GitLens extension installed you should be able to simply select "Restore" action from selected "File history" commit.

GitLens Restore file from File History


I use GitLens for that:

  1. In the source control tab, open File History.
  2. Choose your commit, then right-click Commit.
  3. Click on Revert Commit....

enter image description here


With the source control icon selected, if you then click the ellipsis ... at the top right.

With v1.48 you will see a list of options for submenus: under Commit is Undo Last Commit. Under Changes is Discard All Changes.

git submenus