To stag a deleted file (the second option will only delete the file from git but will keep the local copy, for example, if a file type has been added to .gitignore, to delete files of this type already commited).
gitrmfoogitrm--cachedfoo
git reset --hard <commit>
git reset --hard origin/master
Don't use git checkout but use git switch and git restore.