How to undo 'git add' command, before commit

Written by
Date: 2013-04-24 19:43:13 00:00

I have made some changed on my working directory the other day, not all changes were related between them, so I wanted to commit them separated with two different commit messages.

But I run

git add -A 

And the I realized that, I need to roll git add back. I was lucky I had not issued git commit yet.

What I did was run

git reset [FILE]

For every file I did not want in that commit. Then I finallt run

git commit -m 'message 1'

Finally

git add -A

And

git commit -m 'message 2'

Now each commit had the right files for the message.