How to remove staged changes from git?

To remove your staged changes or to undo your last `git add` command, you can use `git reset`. Running the below command will remove all files from your staging area

git reset

In case you want to remove only a specific file(s), then you can mention the name of the file(s) like this:

# To remove a single file
git reset filename.ext

# You can also remove bunch of files using simple rejex expressions
git reset content/*.png
Originally Posted On: Agaric

Subscribe to GIT.WTF!?!

Don’t miss out on the latest issues. Sign up now to get access to the library of members-only issues.
[email protected]
Subscribe