How to remove directory subtree from staging area?

I created a new repository and launched git add -A . Then I noticed that there is a folder containing about 100 files that should not have been included, so I added it to .gitignore .

How do I clear the middleware area so that I can add all my files again with the updated .gitignore ?

+43
git git-add gitignore
Mar 19 '11 at 3:20
source share
3 answers

In # git, you said that you inadvertently added a directory that should have been ignored, so run

 git rm --cached -r directory-name 

to recursively remove a tree from the root in the directory-name from the index.

Remember to update .gitignore !

+92
Mar 19 2018-11-11T00:
source share

You can simply use the command:

 git reset 
+26
Mar 19 '11 at 3:24
source share

Make sure you remember to put s in --global core.excludesfile .gitignore.txt

excludesfile vs excludefile

Perhaps this will save someone else at the time when I lost ...

+3
May 14 '12 at 2:56
source share



All Articles