Philip Kirkbride
Philip Kirkbride

Reputation: 22899

undo last git add -A

I accidentally ran 'git add -A'

I haven't run a commit since adding those files and I'd like to undo this command.

I realize that I could manually remove files with

git rm --cached <path_to_file>

However several files have been added since and it would be a lot easier to do something like

git rm --cached <path_to_file> -A  

Upvotes: 3

Views: 740

Answers (1)

xdazz
xdazz

Reputation: 160963

Just reset to HEAD will undo it:

git reset HEAD

Upvotes: 4

Related Questions