If a user selects to "Discard All Changes", will this restore a deleted folder in Git for the working tree or will it delete the folder entirely?
Asked
Active
Viewed 49 times
-3
-
3That sounds like something that you could experiment with and observe what happens, and thus learn more directly than having someone describe it to you. – mason Oct 25 '21 at 22:57
-
1Easy to try on a test repo. What happens? – jarmod Oct 25 '21 at 22:57
-
got it, thanks for the help! – kevinjaypatel Oct 25 '21 at 23:04
1 Answers
0
Issue resolved. I was concerned that if I ran the "Discard All Changes" command, my folder would be deleted entirely. I thought that was strange considering that if you visit a single file that was deleted in the folder, VS Code gives the option of restoring that file, but I wanted to undo the entire folder deletion. Since I didn't stage or commit the changes after I deleted the folder, I was able to revert the change in my working tree by running the following command:
git checkout -- path/to/folder
That command allows a user to revert changes that have not been indexed or added to the staging area.
I found this helpful https://stackoverflow.com/a/30875442/10860528

kevinjaypatel
- 45
- 9