Undo git add -A

If you accidentally ran the git add -a and if you want to undo this command, follow the step below:

First of all, check the status by git status

git status

This will show you the list of the files that are staged. It’s not mandatory but good to check. So you can compare the end of undoing the git add command.

Second, type the following command and hit enter: git reset .

git reset all, git reset .

This will unstage all files or remove all the files from the staging area.

That’s it! See how to remove files from Git.

Now if you run the git status again, you’ll see that you successfully performed git add undo.

Git status after git add -A undo

See how you can remove a file from the git commit.

How to undo a specific file(s) from git add -A?

In the above section, you learned how to unstage all files. But sometimes you may need to unstage or remove just one or a couple of specific files instead of all files. This is what you will see in this section.

In the following screenshot below, you see that I have all (three) files staged. Imagine, I need to undo just one file which is “script.js.”

Staged all files using git add -A

To do that, I have to type the following command and hit enter:

git reset script.js

This will reset the git add -A command and remote the script.js from the stage (as you see below).

Unstage a specific files from git add -A

If you need to unstage two files, use the following command: git reset script.js style.scss

undo two files from git add -A

In the same vein, you can unstage any number of files followed by space and then add the file name including the extension.

Note that if you want to remove a file from the stage that lives in a folder, you have to include the path of the file. For example, I have a file named “app.php” that lives in the “vendor” folder. Also, I performed a git add -A command. As you see in the screenshot below.

Staged files where one of them lives in a folder

To remove the file (vendor/app.php), you have to specify the path like this: git reset vendor/app.php

Unstage a file that lives in a folder

This is how you do it.

For your further reading, I have linked the following post that is very related to this one.

Git commands & explanation
How to connect local Git to a remote server?
How to change Git remote origin URL?
Git branch: create, checkout, merge, list, command, delete & push
Switch between git branches
How to change the git commit message?
How to undo the last git commit?


In this post, I tried to explain all the real cases that you need to deal with undoing git add -A. Also, these are the cases that I came across in practical life. If you do not find the answer to your questions which is related to this post, please let me know.