I come from Undo working copy modifications of one file in Git, available in VS 2019 (1). Is this available in VS2019 GUI Git too? (hidden)
Asked
Active
Viewed 48 times
1 Answers
0
In the Git Changes Window, simply right click on a file and select Undo Changes, or click the undo button next to the file name:
If your Git Changes Window isn't open, go to View → Git Changes (or Ctrl + 0, Ctrl + G)

Timothy G.
- 6,335
- 7
- 30
- 46
-
Not exactly, this will undo " the whole branch" not only the single file. – Tom Tom Sep 17 '21 at 16:47
-
1@TomTom I don't believe so. It should only undo changes for the selected file. Try it. Make a fake change to a file, then undo it using this, and observe the results. It should revert the file back to how it was prior to any changes – Timothy G. Sep 17 '21 at 17:01
-
No, even in VS2022 Preview it is still not yet possible! I found this [link](https://developercommunity.visualstudio.com/t/git-revertcheckout-single-file/745267) – Tom Tom Sep 20 '21 at 13:53
-
@TomTom it sounds like your question as written is asking something different than what you want. You asked "Undo working copy modifications of one file" when it sounds like you really want to know how to "Reset a file to a certain commit in Visual Studio" (as the link in your comment suggests this). My answer provided is for the question your title conveys. And again, my solution does not reset the entire branch, only the file you click the undo button on. – Timothy G. Sep 20 '21 at 14:04
-
it can be mislieading, but the title is the same as in the link described. I tried it in VS2019, If you commit more than one file, it is not possible to undo only this one file. It will always undo all the files in the commit. :( – Tom Tom Sep 22 '21 at 10:07