Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

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

I googled it but was unable to find the answer to the question.

Thanks in advance.

P.S I know I can see the changes between commits and the differences in the working tree but I want to know how to reset to the previous commit in visual studio code

like image 834
Vikranth Avatar asked Oct 24 '17 15:10

Vikranth


2 Answers

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

like image 191
Mark Avatar answered Nov 17 '22 14:11

Mark


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

like image 35
jmarceli Avatar answered Nov 17 '22 14:11

jmarceli