Open garretwilson opened 1 year ago
@sofiabe1 and I plan to look into this
Also it seems that "discard changes" button in Source Control view calls git checkout -q -- <file>
command, and can be replaced with git restore
Hi, I'd love to work on this, but if git checkout
is covering all the cases when it comes to discard changes? what would git restore
add then?
Hi, I'd love to work on this, but if
git checkout
is covering all the cases when it comes to discard changes?
First, did you read the links in the description? They explain it in depth.
Secondly, when I hit Ctrl+Shift+P
, I don't see an option for a per-file git checkout
, either. But as pointed out several times in the Stack Overflow question/answer:
… git-restore seems the safer option if you only want to revert local work.
But don't take my word for it. Read all the history and technical details in the link.
There needs to be a command "Git: Restore" which would discard local changes to the file, as if I would have entered
git restore …
in the terminal.As an example of other commands, there already exists a command "Git: Stage Changes" which stages the changes for the current file, as if I would have entered
git add …
in the terminal."Git: Restore" is a very commonly needed command, but it seems to be missing.
See:
git restore
command and what is the difference betweengit restore
andgit reset
?