How to discard staged changes in Git

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 -- ..

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 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.