Discard File Changes by VSCode Instead of git stash
June 24, 2020
This is a small tip for anyone who uses git command daily.
How do you manage when you don't want file changes to be staged but need to checkout another branch?
I have usually cleared a branch by using git stash. git stash is not for discarding unnecessary files but for storing the file changes for just a temporary moment.
I knew that this way would not be ideal but didn't know the proper way of that.
Lately, I have found a much simple solution to discard file changes. Everyone should use that.
Discard file changes
- Use Visual Studio Code
- Select
Sorce Control
in the left option (with shortcut key, Control + Shift + G) - Click
Discard All Changes
That's it! If you have specific files to discard, You only need to select that file.
I'm not familiar with this type of superpower of VSCode. If you know about VSCode tips to improve productivity, Please let me know. I would really appreciate it. Thanks!