Undo git add --all

BendEg picture BendEg · Jan 18, 2015 · Viewed 81.8k times · Source

I made a mistake and called git add -all, now all files are added. I did not make a commit and push. How can I undo my action?

Answer

Simone Carletti picture Simone Carletti · Jan 18, 2015

It has already been answered several times:

You can use git reset. This will 'unstage' all the files you've added after your last commit.

If you want to unstage only some files, use git reset -- <file 1> <file 2> <file n>.

Also it's possible to unstage some of the changes in files by using git reset -p.

See