How to remove unstaged changes in Git

Oct 17, 2022 · 1 min read · Post a comment

As a follow-up to my previous posts linked below, let me show you how to remove unstaged changes in Git. Although it’s much easier and arguably faster to do everything from an IDE GUI like VS Code for instance, the focus here is from the CLI only.


  • Git


Remove unstaged changes to a single file

git checkout -- <filename>

Remove unstaged changes for the entire working tree directory

git checkout -- .


Related posts:

To find more neat Git commands and hacks, simply browse the Git category. Feel free to leave a comment below and if you find this tutorial useful, follow our official channel on Telegram.