In Visual Studio Code, you can rollback all the changes to a file:
But is it possible if you have multiple changes in a file on multiple line numbers, to rollback only one of them, as one can in PhpStorm?
There could be a set of changed files, which you don't want to commit and want to undo the changes that you have already performed. Select those files/folders and right click on them to open the Git context menu, where you can click Undo Changes... to discard them.
Click the (...) button and then select Undo Last Commit to undo the previous commit. The changes are added to the Staged Changes section.
If the file is in the Changes section, right-click it and choose Undo Changes to discard all changes to the file since the last commit. Visual Studio supports discarding all uncommitted changes to a file by reverting the file to its version in the last commit.
“vs code delete multiple lines” Code Answer'sWindows: Ctrl + Alt + Arrow Keys. Linux: Shift + Alt + Arrow Keys. Mac: Opt + Cmd + Arrow Keys.
Update: in the October 2017 release, "inline change review" was introduced, where you can easily discard a particular change in the same way as you would in IntelliJ-based IDEs:
Previously, this was only possible with the Open Changes
UI (located in the upper right of editors ). Alternatively, you can run the Git: Open Changes
command.
In that view, the More
button () offers several options for operating on individual lines, among them Revert Selected Ranges
.
There is Revert Selected Changes
. Either hit Ctrl+Shift+P
on the diff viewer to revert selected or simply use Ctrl+K,R
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With