How to discard unstaged changes in Git

How to discard unstaged changes in Git
0
#1

If you want to discard all unstaged changes, you can do so with this command: git clean -f

This will revert all those files that are unstaged back to their old state.

Note that staging is when you use git add [file] to add a file to Git’s staging area in preparation for committing it.

If you want to discard files that are already staged, you can discard them with git checkout -- [file] or all of them at once with git checkout -- .

3 Likes