git restore
will remove the file from git staging area and thereby NOT include it in the next commit. The local changes themselves are not affected by this command.
use the following command to remove staged file from git
git reset tesfile.php
There is an alternate way to un stage files using git cmd
git checkout tesfile.php
To discard all changes from git branch use the following command
git checkout tesfile.php