How to undo add file in git
Git398
description
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
command
git restore --staged undofile.py
parameter
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.