Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How can I undo, unsaved changes in VS Code?

Are there any shortcuts that allows a user to undo changes(similar to command+z) but back to when the file was last saved? I'm currently getting this done by closing files, discarding changes, and reopening them but this is tedious. Thanks!

like image 684
tableguarder Avatar asked Mar 12 '19 22:03

tableguarder


People also ask

How do I recover unsaved files in VS code?

Click unsaved:* in status bar or launch Command Palette(Mac: F1 or Shift + Command + P , Windows and Linux: F1 or Shift + Ctrl + P ), Execute Unsaved Files: Show command and select a unsaved file as you like.

How do I revert back changes in VS code?

To do the same in Visual Studio, right-click the commit you want to revert and then select Revert.

How do you Undo uncommitted changes in Visual Studio code?

Select those files/folders and right click on them to open the Git context menu, where you can click Undo Changes... to discard them. The files will be reset to the unmodified stage: Sometimes, before performing any commit or undoing the changes, you may want to check what has been changed since your last commit.


1 Answers

In the top left menu:

File > Revert File

On mac this does not have a shortcut assigned per default. You will have to assign a shortcut yourself.

like image 99
Silv Avatar answered Sep 23 '22 21:09

Silv