17

By mistake I used git add . so all files are added in staring area. I want to remove all those files from staring area.

I tried

git clean -fdx

git clean -df

but it isn't worked.

Piyush
  • 3,947
  • 9
  • 36
  • 69
  • possible duplicate of [Undo 'git add' before commit](http://stackoverflow.com/questions/348170/undo-git-add-before-commit) – Joe Apr 22 '15 at 10:22
  • 1
    @Piyush do you only want to do it once? or do you want to ignore these files always? Also you have asked 2 questions in one, it is difficult for the community to find and answer, try asking a new question about adding only folders and not files. – dubes Apr 22 '15 at 10:33

3 Answers3

19

you need use the git reset --mixed.
The --mixed if for clearing the stage/cache/index area.

CodeWizard
  • 128,036
  • 21
  • 144
  • 167
9

You can also do like this:

git reset . <-- will remove files from current index

git reset <filename> <-- for a specific file.
Abu Shumon
  • 1,834
  • 22
  • 36
2

If that is the case, then git reset HEAD will do the job

icode03
  • 106
  • 8