How to remove files from git staging area?

后端 未结 14 1284
失恋的感觉
失恋的感觉 2020-11-28 16:53

I made changes to some of my files in my local repo, and then I did git add -A which I think added too many files to the staging area. How can I delete all the

14条回答
  •  没有蜡笔的小新
    2020-11-28 17:42

    If you've already committed a bunch of unwanted files, you can unstage them and tell git to mark them as deleted (without actually deleting them) with

    git rm --cached -r .
    

    --cached tells it to remove the paths from staging and the index without removing the files themselves and -r operates on directories recursively. You can then git add any files that you want to keep tracking.

提交回复
热议问题