How to remove files from git staging area?

后端 未结 14 1282
失恋的感觉
失恋的感觉 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:46

    You can unstage files from the index using

    git reset HEAD -- path/to/file
    

    Just like git add, you can unstage files recursively by directory and so forth, so to unstage everything at once, run this from the root directory of your repository:

    git reset HEAD -- .
    

    Also, for future reference, the output of git status will tell you the commands you need to run to move files from one state to another.

提交回复
热议问题