How to undo add file in git
When using Git to manage code, you may encounter the following scenarios. The file has been successfully added through git add, and you want to undo this operation. You can use git restore to achieve this operation. In this example, we implement the undo operation on the file undofile.py that has been successfully added by git
git restore --staged undofile.py
git : is a free and open source distributed version control system restore : Restore working tree files -S, --staged : Specify the restore location. If neither option is specified, by default the working tree is restored. Specifying --staged will only restore the index. Specifying both restores both.