If you add a file to staging area and want to undo the action, use below command :
# Undo add action for a file
# --, the following parameter will be parsed as a file path
$ git reset HEAD -- <file-path>
# Examples:
# Undo add action for index.php
$ git reset -- index.php
If you want to undo add
action for all files added to staging area :
$ git reset HEAD
If fact, git status
tells you how to unstage a file :
$ git add index.php
$ git status
On branch master
Changes to be committed:
(use "git reset HEAD <file>..." to unstage)
modified: index.php